| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/common/chrome_switches.h" | 6 #include "chrome/common/chrome_switches.h" |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "chrome/common/extensions/extension_manifest_constants.h" | 8 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 9 #include "chrome/common/extensions/manifest.h" | 9 #include "chrome/common/extensions/manifest.h" |
| 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Ignore the policy delegate for this test. | 24 // Ignore the policy delegate for this test. |
| 25 PermissionsData::SetPolicyDelegate(NULL); | 25 PermissionsData::SetPolicyDelegate(NULL); |
| 26 CommandLine::ForCurrentProcess()->AppendSwitch( | 26 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 27 switches::kExtensionsOnChromeURLs); | 27 switches::kExtensionsOnChromeURLs); |
| 28 std::string error; | 28 std::string error; |
| 29 scoped_refptr<Extension> extension = | 29 scoped_refptr<Extension> extension = |
| 30 LoadAndExpectSuccess("permission_chrome_url_invalid.json"); | 30 LoadAndExpectSuccess("permission_chrome_url_invalid.json"); |
| 31 EXPECT_EQ("", error); | 31 EXPECT_EQ("", error); |
| 32 const GURL newtab_url("chrome://newtab/"); | 32 const GURL newtab_url("chrome://newtab/"); |
| 33 EXPECT_TRUE(PermissionsData::CanExecuteScriptOnPage( | 33 EXPECT_TRUE(PermissionsData::CanExecuteScriptOnPage( |
| 34 extension, newtab_url, newtab_url, 0, NULL, -1, &error)) << error; | 34 extension.get(), newtab_url, newtab_url, 0, NULL, -1, &error)) << error; |
| 35 } | 35 } |
| 36 | 36 |
| 37 TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { | 37 TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { |
| 38 LoadAndExpectError("permission_chrome_resources_url.json", | 38 LoadAndExpectError("permission_chrome_resources_url.json", |
| 39 errors::kInvalidPermissionScheme); | 39 errors::kInvalidPermissionScheme); |
| 40 std::string error; | 40 std::string error; |
| 41 LoadExtension(Manifest("permission_chrome_resources_url.json"), | 41 LoadExtension(Manifest("permission_chrome_resources_url.json"), |
| 42 &error, | 42 &error, |
| 43 extensions::Manifest::COMPONENT, | 43 extensions::Manifest::COMPONENT, |
| 44 Extension::NO_FLAGS); | 44 Extension::NO_FLAGS); |
| 45 EXPECT_EQ("", error); | 45 EXPECT_EQ("", error); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace extensions | 48 } // namespace extensions |
| OLD | NEW |