| Index: ppapi/tests/test_broker.cc
|
| diff --git a/ppapi/tests/test_broker.cc b/ppapi/tests/test_broker.cc
|
| index ab27b0bdd9e998a896207f08612b8d65802a3812..63bbd1cee5dd6d6aef4f1f4f19401bc739b90d70 100644
|
| --- a/ppapi/tests/test_broker.cc
|
| +++ b/ppapi/tests/test_broker.cc
|
| @@ -214,6 +214,14 @@ void TestBroker::RunTests(const std::string& filter) {
|
| RUN_TEST(GetHandleFailure, filter);
|
| RUN_TEST_FORCEASYNC_AND_NOT(ConnectFailure, filter);
|
| RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndPipe, filter);
|
| +
|
| + // The following tests require special setup, so only run them if they're
|
| + // explicitly specified by the filter.
|
| + if (filter.empty())
|
| + return;
|
| +
|
| + RUN_TEST(ConnectPermissionDenied, filter);
|
| + RUN_TEST(ConnectPermissionGranted, filter);
|
| }
|
|
|
| std::string TestBroker::TestCreate() {
|
| @@ -278,3 +286,34 @@ std::string TestBroker::TestConnectAndPipe() {
|
|
|
| PASS();
|
| }
|
| +
|
| +std::string TestBroker::TestConnectPermissionDenied() {
|
| + // This assumes that the browser side is set up to deny access to the broker.
|
| + PP_Resource broker = broker_interface_->CreateTrusted(
|
| + instance_->pp_instance());
|
| + ASSERT_TRUE(broker);
|
| +
|
| + 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_ERROR_NOACCESS, callback.result());
|
| +
|
| + PASS();
|
| +}
|
| +
|
| +std::string TestBroker::TestConnectPermissionGranted() {
|
| + // This assumes that the browser side is set up to allow access to the broker.
|
| + PP_Resource broker = broker_interface_->CreateTrusted(
|
| + instance_->pp_instance());
|
| + ASSERT_TRUE(broker);
|
| +
|
| + 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());
|
| +
|
| + PASS();
|
| +}
|
| +
|
|
|