Implement inspect action for workers in Task Manager
[chromium-blink-merge.git] / ppapi / tests / test_utils.h
blobe786aa83e69d78503a5824a78d611b292f4158a1
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_TESTS_TEST_UTILS_H_
6 #define PPAPI_TESTS_TEST_UTILS_H_
8 #include <string>
10 #include "ppapi/c/dev/ppb_testing_dev.h"
11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/cpp/completion_callback.h"
15 const PPB_Testing_Dev* GetTestingInterface();
16 std::string ReportError(const char* method, int32_t error);
18 class TestCompletionCallback {
19 public:
20 TestCompletionCallback(PP_Instance instance);
21 TestCompletionCallback(PP_Instance instance, bool force_async);
23 // Waits for the callback to be called and returns the
24 // result. Returns immediately if the callback was previously called
25 // and the result wasn't returned (i.e. each result value received
26 // by the callback is returned by WaitForResult() once and only
27 // once).
28 int32_t WaitForResult();
30 operator pp::CompletionCallback() const;
32 unsigned run_count() const { return run_count_; }
33 void reset_run_count() { run_count_ = 0; }
35 int32_t result() const { return result_; }
37 private:
38 static void Handler(void* user_data, int32_t result);
40 bool have_result_;
41 int32_t result_;
42 bool force_async_;
43 bool post_quit_task_;
44 unsigned run_count_;
45 PP_Instance instance_;
48 #endif // PPAPI_TESTS_TEST_UTILS_H_