| 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 Reload(); | 357 Reload(); |
| 358 | 358 |
| 359 EXPECT_FALSE(IsAllowed(extension, google)); | 359 EXPECT_FALSE(IsAllowed(extension, google)); |
| 360 EXPECT_FALSE(IsAllowed(extension, google_h1)); | 360 EXPECT_FALSE(IsAllowed(extension, google_h1)); |
| 361 EXPECT_FALSE(IsAllowed(extension, chromium)); | 361 EXPECT_FALSE(IsAllowed(extension, chromium)); |
| 362 EXPECT_FALSE(IsAllowed(extension, chromium_h1)); | 362 EXPECT_FALSE(IsAllowed(extension, chromium_h1)); |
| 363 } | 363 } |
| 364 | 364 |
| 365 TEST_F(ActiveTabTest, ChromeUrlGrants) { | 365 TEST_F(ActiveTabTest, ChromeUrlGrants) { |
| 366 GURL internal("chrome://version"); | 366 GURL internal("chrome://about"); |
| 367 NavigateAndCommit(internal); | 367 NavigateAndCommit(internal); |
| 368 active_tab_permission_granter()->GrantIfRequested( | 368 active_tab_permission_granter()->GrantIfRequested( |
| 369 extension_with_tab_capture.get()); | 369 extension_with_tab_capture.get()); |
| 370 // Do not grant tabs/hosts permissions for tab. | 370 // Do not grant tabs/hosts permissions for tab. |
| 371 EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal, | 371 EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal, |
| 372 PERMITTED_CAPTURE_ONLY)); | 372 PERMITTED_CAPTURE_ONLY)); |
| 373 const PermissionsData* permissions_data = | 373 const PermissionsData* permissions_data = |
| 374 extension_with_tab_capture->permissions_data(); | 374 extension_with_tab_capture->permissions_data(); |
| 375 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( | 375 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( |
| 376 tab_id(), APIPermission::kTabCaptureForTab)); | 376 tab_id(), APIPermission::kTabCaptureForTab)); |
| 377 | 377 |
| 378 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); | 378 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); |
| 379 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( | 379 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( |
| 380 tab_id() + 1, APIPermission::kTabCaptureForTab)); | 380 tab_id() + 1, APIPermission::kTabCaptureForTab)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace | 383 } // namespace |
| 384 } // namespace extensions | 384 } // namespace extensions |
| OLD | NEW |