| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 void TestBroker::RunTests(const std::string& filter) { | 211 void TestBroker::RunTests(const std::string& filter) { |
| 212 RUN_TEST(Create, filter); | 212 RUN_TEST(Create, filter); |
| 213 RUN_TEST(Create, filter); | 213 RUN_TEST(Create, filter); |
| 214 RUN_TEST(GetHandleFailure, filter); | 214 RUN_TEST(GetHandleFailure, filter); |
| 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 (!ShouldRunAllTests(filter)) { |
| 221 return; | 221 RUN_TEST(ConnectPermissionDenied, filter); |
| 222 | 222 RUN_TEST(ConnectPermissionGranted, filter); |
| 223 RUN_TEST(ConnectPermissionDenied, filter); | 223 RUN_TEST(IsAllowedPermissionDenied, filter); |
| 224 RUN_TEST(ConnectPermissionGranted, filter); | 224 RUN_TEST(IsAllowedPermissionGranted, filter); |
| 225 RUN_TEST(IsAllowedPermissionDenied, filter); | 225 } |
| 226 RUN_TEST(IsAllowedPermissionGranted, filter); | |
| 227 } | 226 } |
| 228 | 227 |
| 229 std::string TestBroker::TestCreate() { | 228 std::string TestBroker::TestCreate() { |
| 230 // Very simplistic test to make sure we can create a broker interface. | 229 // Very simplistic test to make sure we can create a broker interface. |
| 231 // TODO(raymes): All of the resources created in this file are leaked. Write | 230 // TODO(raymes): All of the resources created in this file are leaked. Write |
| 232 // a C++ wrapper for PPB_Broker_Trusted to avoid these leaks. | 231 // a C++ wrapper for PPB_Broker_Trusted to avoid these leaks. |
| 233 PP_Resource broker = broker_interface_->CreateTrusted( | 232 PP_Resource broker = broker_interface_->CreateTrusted( |
| 234 instance_->pp_instance()); | 233 instance_->pp_instance()); |
| 235 ASSERT_TRUE(broker); | 234 ASSERT_TRUE(broker); |
| 236 | 235 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 330 } |
| 332 | 331 |
| 333 std::string TestBroker::TestIsAllowedPermissionGranted() { | 332 std::string TestBroker::TestIsAllowedPermissionGranted() { |
| 334 PP_Resource broker = broker_interface_->CreateTrusted( | 333 PP_Resource broker = broker_interface_->CreateTrusted( |
| 335 instance_->pp_instance()); | 334 instance_->pp_instance()); |
| 336 ASSERT_TRUE(broker); | 335 ASSERT_TRUE(broker); |
| 337 ASSERT_EQ(PP_TRUE, broker_interface_->IsAllowed(broker)); | 336 ASSERT_EQ(PP_TRUE, broker_interface_->IsAllowed(broker)); |
| 338 | 337 |
| 339 PASS(); | 338 PASS(); |
| 340 } | 339 } |
| OLD | NEW |