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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 | 354 |
| 355 Reload(); | 355 Reload(); |
| 356 | 356 |
| 357 EXPECT_FALSE(IsAllowed(extension, google)); | 357 EXPECT_FALSE(IsAllowed(extension, google)); |
| 358 EXPECT_FALSE(IsAllowed(extension, google_h1)); | 358 EXPECT_FALSE(IsAllowed(extension, google_h1)); |
| 359 EXPECT_FALSE(IsAllowed(extension, chromium)); | 359 EXPECT_FALSE(IsAllowed(extension, chromium)); |
| 360 EXPECT_FALSE(IsAllowed(extension, chromium_h1)); | 360 EXPECT_FALSE(IsAllowed(extension, chromium_h1)); |
| 361 } | 361 } |
| 362 | 362 |
| 363 TEST_F(ActiveTabTest, ChromeUrlGrants) { | 363 TEST_F(ActiveTabTest, ChromeUrlGrants) { |
| 364 GURL internal("chrome://version"); | 364 GURL internal("chrome://about"); |
|
Dan Beam
2015/12/09 21:45:07
why is this necessary?
dpapad
2015/12/10 01:08:27
This is already explained previously in this revie
| |
| 365 NavigateAndCommit(internal); | 365 NavigateAndCommit(internal); |
| 366 active_tab_permission_granter()->GrantIfRequested( | 366 active_tab_permission_granter()->GrantIfRequested( |
| 367 extension_with_tab_capture.get()); | 367 extension_with_tab_capture.get()); |
| 368 // Do not grant tabs/hosts permissions for tab. | 368 // Do not grant tabs/hosts permissions for tab. |
| 369 EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal, | 369 EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal, |
| 370 PERMITTED_CAPTURE_ONLY)); | 370 PERMITTED_CAPTURE_ONLY)); |
| 371 const PermissionsData* permissions_data = | 371 const PermissionsData* permissions_data = |
| 372 extension_with_tab_capture->permissions_data(); | 372 extension_with_tab_capture->permissions_data(); |
| 373 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( | 373 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( |
| 374 tab_id(), APIPermission::kTabCaptureForTab)); | 374 tab_id(), APIPermission::kTabCaptureForTab)); |
| 375 | 375 |
| 376 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); | 376 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); |
| 377 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( | 377 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( |
| 378 tab_id() + 1, APIPermission::kTabCaptureForTab)); | 378 tab_id() + 1, APIPermission::kTabCaptureForTab)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace | 381 } // namespace |
| 382 } // namespace extensions | 382 } // namespace extensions |
| OLD | NEW |