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

Unified Diff: ppapi/tests/test_broker.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/tracked_callback.cc ('k') | ppapi/tests/test_case.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_broker.cc
diff --git a/ppapi/tests/test_broker.cc b/ppapi/tests/test_broker.cc
index 478168b27c8039be0f6a13162ca165fdba05fe58..ab27b0bdd9e998a896207f08612b8d65802a3812 100644
--- a/ppapi/tests/test_broker.cc
+++ b/ppapi/tests/test_broker.cc
@@ -212,8 +212,8 @@ void TestBroker::RunTests(const std::string& filter) {
RUN_TEST(Create, filter);
RUN_TEST(Create, filter);
RUN_TEST(GetHandleFailure, filter);
- RUN_TEST(ConnectFailure, filter);
- RUN_TEST(ConnectAndPipe, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ConnectFailure, filter);
+ RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndPipe, filter);
}
std::string TestBroker::TestCreate() {
@@ -230,20 +230,11 @@ std::string TestBroker::TestCreate() {
// Test connection on invalid resource.
std::string TestBroker::TestConnectFailure() {
- // Callback NOT force async. Connect should fail. The callback will not be
- // posted so there's no need to wait for the callback to complete.
- TestCompletionCallback cb_1(instance_->pp_instance(), false);
- ASSERT_EQ(PP_ERROR_BADRESOURCE,
- broker_interface_->Connect(
- 0, pp::CompletionCallback(cb_1).pp_completion_callback()));
-
- // Callback force async. Connect will return PP_OK_COMPLETIONPENDING and the
- // callback will be posted. However, the callback should fail.
- TestCompletionCallback cb_2(instance_->pp_instance(), true);
- ASSERT_EQ(PP_OK_COMPLETIONPENDING,
- broker_interface_->Connect(
- 0, pp::CompletionCallback(cb_2).pp_completion_callback()));
- ASSERT_EQ(PP_ERROR_BADRESOURCE, cb_2.WaitForResult());
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(broker_interface_->Connect(0,
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
PASS();
}
@@ -268,11 +259,11 @@ std::string TestBroker::TestConnectAndPipe() {
instance_->pp_instance());
ASSERT_TRUE(broker);
- TestCompletionCallback cb_3(instance_->pp_instance());
- ASSERT_EQ(PP_OK_COMPLETIONPENDING,
- broker_interface_->Connect(
- broker, pp::CompletionCallback(cb_3).pp_completion_callback()));
- ASSERT_EQ(PP_OK, cb_3.WaitForResult());
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(broker_interface_->Connect(broker,
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
int32_t handle = kInvalidHandle;
ASSERT_EQ(PP_OK, broker_interface_->GetHandle(broker, &handle));
« no previous file with comments | « ppapi/shared_impl/tracked_callback.cc ('k') | ppapi/tests/test_case.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698