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

Unified Diff: ppapi/tests/test_broker.cc

Issue 10826164: Add infobar for PPAPI broker usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 3 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/tests/test_broker.h ('k') | ppapi/tests/testing_instance.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 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();
+}
+
« no previous file with comments | « ppapi/tests/test_broker.h ('k') | ppapi/tests/testing_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698