Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc

Issue 1150683007: [Extensions] Use document url (not top url) for tab-specific permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/permissions/permissions_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698