From 3ab612746af9bfa1f7d502b7851330423f71c672 Mon Sep 17 00:00:00 2001 From: "dmichael@chromium.org" Date: Sat, 7 Apr 2012 00:09:08 +0000 Subject: 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" 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 --- ppapi/tests/test_flash_fullscreen.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ppapi/tests/test_flash_fullscreen.cc') 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(); } } -- cgit v1.1