Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Side by Side Diff: ppapi/tests/test_utils.h

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | ppapi/tests/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_TESTS_TEST_UTILS_H_ 5 #ifndef PPAPI_TESTS_TEST_UTILS_H_
6 #define PPAPI_TESTS_TEST_UTILS_H_ 6 #define PPAPI_TESTS_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ppapi/c/dev/ppb_testing_dev.h" 10 #include "ppapi/c/dev/ppb_testing_dev.h"
11 #include "ppapi/c/pp_instance.h" 11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_stdint.h" 12 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/cpp/completion_callback.h" 13 #include "ppapi/cpp/completion_callback.h"
14 14
15 const PPB_Testing_Dev* GetTestingInterface(); 15 const PPB_Testing_Dev* GetTestingInterface();
16 std::string ReportError(const char* method, int32_t error); 16 std::string ReportError(const char* method, int32_t error);
17 17
18 class TestCompletionCallback { 18 class TestCompletionCallback {
19 public: 19 public:
20 TestCompletionCallback(PP_Instance instance); 20 TestCompletionCallback(PP_Instance instance);
21 TestCompletionCallback(PP_Instance instance, bool force_async);
21 22
22 // Waits for the callback to be called and returns the 23 // Waits for the callback to be called and returns the
23 // result. Returns immediately if the callback was previously called 24 // result. Returns immediately if the callback was previously called
24 // and the result wasn't returned (i.e. each result value received 25 // and the result wasn't returned (i.e. each result value received
25 // by the callback is returned by WaitForResult() once and only 26 // by the callback is returned by WaitForResult() once and only
26 // once). 27 // once).
27 int32_t WaitForResult(); 28 int32_t WaitForResult();
28 29
29 operator pp::CompletionCallback() const; 30 operator pp::CompletionCallback() const;
30 31
31 unsigned run_count() const { return run_count_; } 32 unsigned run_count() const { return run_count_; }
32 void reset_run_count() { run_count_ = 0; } 33 void reset_run_count() { run_count_ = 0; }
33 34
34 int32_t result() const { return result_; } 35 int32_t result() const { return result_; }
35 36
36 private: 37 private:
37 static void Handler(void* user_data, int32_t result); 38 static void Handler(void* user_data, int32_t result);
38 39
39 bool have_result_; 40 bool have_result_;
40 int32_t result_; 41 int32_t result_;
42 bool force_async_;
41 bool post_quit_task_; 43 bool post_quit_task_;
42 unsigned run_count_; 44 unsigned run_count_;
43 PP_Instance instance_; 45 PP_Instance instance_;
44 }; 46 };
45 47
46 #endif // PPAPI_TESTS_TEST_UTILS_H_ 48 #endif // PPAPI_TESTS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | ppapi/tests/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698