| 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/extensions/manifest_tests/chrome_manifest_test.h" | 6 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 7 #include "chrome/common/url_constants.h" | 7 #include "chrome/common/url_constants.h" |
| 8 #include "extensions/common/error_utils.h" | 8 #include "extensions/common/error_utils.h" |
| 9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
| 10 #include "extensions/common/manifest.h" | 10 #include "extensions/common/manifest.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Ignore the policy delegate for this test. | 30 // Ignore the policy delegate for this test. |
| 31 PermissionsData::SetPolicyDelegate(NULL); | 31 PermissionsData::SetPolicyDelegate(NULL); |
| 32 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 32 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 33 switches::kExtensionsOnChromeURLs); | 33 switches::kExtensionsOnChromeURLs); |
| 34 std::string error; | 34 std::string error; |
| 35 scoped_refptr<Extension> extension = | 35 scoped_refptr<Extension> extension = |
| 36 LoadAndExpectSuccess("permission_chrome_url_invalid.json"); | 36 LoadAndExpectSuccess("permission_chrome_url_invalid.json"); |
| 37 EXPECT_EQ("", error); | 37 EXPECT_EQ("", error); |
| 38 const GURL newtab_url(chrome::kChromeUINewTabURL); | 38 const GURL newtab_url(chrome::kChromeUINewTabURL); |
| 39 EXPECT_TRUE(extension->permissions_data()->CanAccessPage( | 39 EXPECT_TRUE(extension->permissions_data()->CanAccessPage( |
| 40 extension.get(), newtab_url, newtab_url, 0, -1, &error)) | 40 extension.get(), newtab_url, 0, -1, &error)) << error; |
| 41 << error; | |
| 42 } | 41 } |
| 43 | 42 |
| 44 TEST_F(ChromePermissionManifestTest, | 43 TEST_F(ChromePermissionManifestTest, |
| 45 ChromeResourcesPermissionValidOnlyForComponents) { | 44 ChromeResourcesPermissionValidOnlyForComponents) { |
| 46 LoadAndExpectWarning("permission_chrome_resources_url.json", | 45 LoadAndExpectWarning("permission_chrome_resources_url.json", |
| 47 ErrorUtils::FormatErrorMessage( | 46 ErrorUtils::FormatErrorMessage( |
| 48 errors::kInvalidPermissionScheme, | 47 errors::kInvalidPermissionScheme, |
| 49 "chrome://resources/")); | 48 "chrome://resources/")); |
| 50 std::string error; | 49 std::string error; |
| 51 LoadExtension(ManifestData("permission_chrome_resources_url.json"), | 50 LoadExtension(ManifestData("permission_chrome_resources_url.json"), |
| 52 &error, | 51 &error, |
| 53 extensions::Manifest::COMPONENT, | 52 extensions::Manifest::COMPONENT, |
| 54 Extension::NO_FLAGS); | 53 Extension::NO_FLAGS); |
| 55 EXPECT_EQ("", error); | 54 EXPECT_EQ("", error); |
| 56 } | 55 } |
| 57 | 56 |
| 58 } // namespace extensions | 57 } // namespace extensions |
| OLD | NEW |