diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 00:09:08 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 00:09:08 +0000 |
commit | 3ab612746af9bfa1f7d502b7851330423f71c672 (patch) | |
tree | dabdc0200d609cec040c5df4f5042a88cb343e83 /ppapi/tests/test_flash_fullscreen.cc | |
parent | 4af886ca90a6262620eebdc9ab49b7b71b9ca33b (diff) | |
download | chromium_src-3ab612746af9bfa1f7d502b7851330423f71c672.zip chromium_src-3ab612746af9bfa1f7d502b7851330423f71c672.tar.gz chromium_src-3ab612746af9bfa1f7d502b7851330423f71c672.tar.bz2 |
PPAPI: Refactor ppapi test callbacks to ease testing blocking callbacks.
There are really 3 changes to test_utils:
- Change "force_async_" to "callback_type_" so that we can represent REQUIRED, OPTIONAL, _and_ BLOCKING. (I left backwards compatibility with force_async_ and will follow up to change them all after this CL).
- Add a new form of WaitForResult and a new CHECK_CALLBACK_BEHAVIOR macro. This simplifies checking that the callback ran as expected (i.e., asynchronous or not). test_url_loader.cc in this CL is a good example of the new form. (My intent is to remove the existing WaitForResult in the aforementioned follow-up CL).
- Add TestCompletionCallback::GetCallback. This is a minor thing, but it means we can get rid of a bunch of ugly "static_cast<pp::CompletionCallback>" in the tests (see test_websocket.cc for an example of that).
BUG=92909
TEST=
Review URL: http://codereview.chromium.org/9937001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131215 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_flash_fullscreen.cc')
-rw-r--r-- | ppapi/tests/test_flash_fullscreen.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ppapi/tests/test_flash_fullscreen.cc b/ppapi/tests/test_flash_fullscreen.cc index b724fef..819ffab 100644 --- a/ppapi/tests/test_flash_fullscreen.cc +++ b/ppapi/tests/test_flash_fullscreen.cc @@ -40,8 +40,8 @@ TestFlashFullscreen::TestFlashFullscreen(TestingInstance* instance) screen_mode_(instance), fullscreen_pending_(false), normal_pending_(false), - fullscreen_callback_(instance->pp_instance()), - normal_callback_(instance->pp_instance()) { + fullscreen_event_(instance->pp_instance()), + normal_event_(instance->pp_instance()) { screen_mode_.GetScreenSize(&screen_size_); } @@ -86,7 +86,7 @@ std::string TestFlashFullscreen::TestNormalToFullscreenToNormal() { } // DidChangeView() will call the callback once in fullscreen mode. - fullscreen_callback_.WaitForResult(); + fullscreen_event_.Wait(); if (fullscreen_pending_) return "fullscreen_pending_ has not been reset"; if (!screen_mode_.IsFullscreen()) @@ -116,7 +116,7 @@ std::string TestFlashFullscreen::TestNormalToFullscreenToNormal() { if (testing_interface_->IsOutOfProcess()) { if (!screen_mode_.IsFullscreen()) return ReportError("IsFullscreen() in normal transition", false); - normal_callback_.WaitForResult(); + normal_event_.Wait(); if (normal_pending_) return "normal_pending_ has not been reset"; } @@ -140,11 +140,11 @@ void TestFlashFullscreen::DidChangeView(const pp::View& view) { pp::Rect clip = view.GetClipRect(); if (fullscreen_pending_ && IsFullscreenView(position, clip, screen_size_)) { fullscreen_pending_ = false; - pp::Module::Get()->core()->CallOnMainThread(0, fullscreen_callback_); + fullscreen_event_.Signal(); } else if (normal_pending_ && !IsFullscreenView(position, clip, screen_size_)) { normal_pending_ = false; if (testing_interface_->IsOutOfProcess()) - pp::Module::Get()->core()->CallOnMainThread(0, normal_callback_); + normal_event_.Signal(); } } |