Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/tests/test_broker.h" | 5 #include "ppapi/tests/test_broker.h" |
| 6 | 6 |
| 7 #if defined(_MSC_VER) | 7 #if defined(_MSC_VER) |
| 8 #define OS_WIN 1 | 8 #define OS_WIN 1 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #else | 10 #else |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 RUN_TEST_FORCEASYNC_AND_NOT(ConnectFailure, filter); | 215 RUN_TEST_FORCEASYNC_AND_NOT(ConnectFailure, filter); |
| 216 RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndPipe, filter); | 216 RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndPipe, filter); |
| 217 | 217 |
| 218 // The following tests require special setup, so only run them if they're | 218 // The following tests require special setup, so only run them if they're |
| 219 // explicitly specified by the filter. | 219 // explicitly specified by the filter. |
| 220 if (filter.empty()) | 220 if (filter.empty()) |
| 221 return; | 221 return; |
| 222 | 222 |
| 223 RUN_TEST(ConnectPermissionDenied, filter); | 223 RUN_TEST(ConnectPermissionDenied, filter); |
| 224 RUN_TEST(ConnectPermissionGranted, filter); | 224 RUN_TEST(ConnectPermissionGranted, filter); |
| 225 RUN_TEST(IsAllowedPermissionDenied, filter); | |
| 226 RUN_TEST(IsAllowedPermissionGranted, filter); | |
| 225 } | 227 } |
| 226 | 228 |
| 227 std::string TestBroker::TestCreate() { | 229 std::string TestBroker::TestCreate() { |
| 228 // Very simplistic test to make sure we can create a broker interface. | 230 // Very simplistic test to make sure we can create a broker interface. |
| 229 PP_Resource broker = broker_interface_->CreateTrusted( | 231 PP_Resource broker = broker_interface_->CreateTrusted( |
| 230 instance_->pp_instance()); | 232 instance_->pp_instance()); |
| 231 ASSERT_TRUE(broker); | 233 ASSERT_TRUE(broker); |
| 232 | 234 |
| 233 ASSERT_FALSE(broker_interface_->IsBrokerTrusted(0)); | 235 ASSERT_FALSE(broker_interface_->IsBrokerTrusted(0)); |
| 234 ASSERT_TRUE(broker_interface_->IsBrokerTrusted(broker)); | 236 ASSERT_TRUE(broker_interface_->IsBrokerTrusted(broker)); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 | 312 |
| 311 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 313 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| 312 callback.WaitForResult(broker_interface_->Connect(broker, | 314 callback.WaitForResult(broker_interface_->Connect(broker, |
| 313 callback.GetCallback().pp_completion_callback())); | 315 callback.GetCallback().pp_completion_callback())); |
| 314 CHECK_CALLBACK_BEHAVIOR(callback); | 316 CHECK_CALLBACK_BEHAVIOR(callback); |
| 315 ASSERT_EQ(PP_OK, callback.result()); | 317 ASSERT_EQ(PP_OK, callback.result()); |
| 316 | 318 |
| 317 PASS(); | 319 PASS(); |
| 318 } | 320 } |
| 319 | 321 |
| 322 std::string TestBroker::TestIsAllowedPermissionDenied() { | |
| 323 PP_Resource broker = broker_interface_->CreateTrusted( | |
|
yzshen1
2012/12/06 19:59:46
Is this leaked?
raymes
2012/12/07 21:32:19
Good catch. But this is the case with all of the t
yzshen1
2012/12/07 21:54:34
You can use the raw C interface PPB_Core to releas
| |
| 324 instance_->pp_instance()); | |
| 325 ASSERT_TRUE(broker); | |
| 326 ASSERT_EQ(PP_FALSE, broker_interface_->IsAllowed(broker)); | |
| 327 | |
| 328 PASS(); | |
| 329 } | |
| 330 | |
| 331 std::string TestBroker::TestIsAllowedPermissionGranted() { | |
| 332 PP_Resource broker = broker_interface_->CreateTrusted( | |
|
yzshen1
2012/12/06 19:59:46
Is this leaked?
raymes
2012/12/07 21:32:19
As above.
| |
| 333 instance_->pp_instance()); | |
| 334 ASSERT_TRUE(broker); | |
| 335 ASSERT_EQ(PP_TRUE, broker_interface_->IsAllowed(broker)); | |
| 336 | |
| 337 PASS(); | |
| 338 } | |
| OLD | NEW |