| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/active_script_controller.h" | 8 #include "chrome/browser/extensions/active_script_controller.h" |
| 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 .Set("description", "an extension") | 103 .Set("description", "an extension") |
| 104 .Set("manifest_version", 2) | 104 .Set("manifest_version", 2) |
| 105 .Set("version", "1.0.0") | 105 .Set("version", "1.0.0") |
| 106 .Set("permissions", | 106 .Set("permissions", |
| 107 ListBuilder().Append(kAllHostsPermission))) | 107 ListBuilder().Append(kAllHostsPermission))) |
| 108 .SetLocation(Manifest::INTERNAL) | 108 .SetLocation(Manifest::INTERNAL) |
| 109 .SetID(kId) | 109 .SetID(kId) |
| 110 .Build(); | 110 .Build(); |
| 111 | 111 |
| 112 ExtensionRegistry::Get(profile())->AddEnabled(extension_); | 112 ExtensionRegistry::Get(profile())->AddEnabled(extension_); |
| 113 PermissionsUpdater(profile()).InitializePermissions(extension_); | 113 PermissionsUpdater(profile()).InitializePermissions(extension_.get()); |
| 114 return extension_; | 114 return extension_.get(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 const Extension* ActiveScriptControllerUnitTest::ReloadExtension() { | 117 const Extension* ActiveScriptControllerUnitTest::ReloadExtension() { |
| 118 ExtensionRegistry::Get(profile())->RemoveEnabled(extension_->id()); | 118 ExtensionRegistry::Get(profile())->RemoveEnabled(extension_->id()); |
| 119 return AddExtension(); | 119 return AddExtension(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool ActiveScriptControllerUnitTest::RequiresUserConsent( | 122 bool ActiveScriptControllerUnitTest::RequiresUserConsent( |
| 123 const Extension* extension) const { | 123 const Extension* extension) const { |
| 124 PermissionsData::AccessType access_type = | 124 PermissionsData::AccessType access_type = |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 EXPECT_TRUE(RequiresUserConsent(extension)); | 402 EXPECT_TRUE(RequiresUserConsent(extension)); |
| 403 // Different subdomain... | 403 // Different subdomain... |
| 404 NavigateAndCommit(GURL("https://en.google.com/foo/bar")); | 404 NavigateAndCommit(GURL("https://en.google.com/foo/bar")); |
| 405 EXPECT_TRUE(RequiresUserConsent(extension)); | 405 EXPECT_TRUE(RequiresUserConsent(extension)); |
| 406 // Only the "always run" origin should be allowed to run without user consent. | 406 // Only the "always run" origin should be allowed to run without user consent. |
| 407 NavigateAndCommit(GURL("https://www.google.com/foo/bar")); | 407 NavigateAndCommit(GURL("https://www.google.com/foo/bar")); |
| 408 EXPECT_FALSE(RequiresUserConsent(extension)); | 408 EXPECT_FALSE(RequiresUserConsent(extension)); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace extensions | 411 } // namespace extensions |
| OLD | NEW |