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

Side by Side Diff: chrome/browser/extensions/api/permissions/permissions_apitest.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/permissions/permissions_api.h" 5 #include "chrome/browser/extensions/api/permissions/permissions_api.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_prefs.h" 7 #include "chrome/browser/extensions/extension_prefs.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 APIPermissionSet apis; 73 APIPermissionSet apis;
74 apis.insert(APIPermission::kBookmark); 74 apis.insert(APIPermission::kBookmark);
75 URLPatternSet explicit_hosts; 75 URLPatternSet explicit_hosts;
76 AddPattern(&explicit_hosts, "http://*.c.com/*"); 76 AddPattern(&explicit_hosts, "http://*.c.com/*");
77 scoped_refptr<PermissionSet> granted_permissions = 77 scoped_refptr<PermissionSet> granted_permissions =
78 new PermissionSet(apis, explicit_hosts, URLPatternSet()); 78 new PermissionSet(apis, explicit_hosts, URLPatternSet());
79 79
80 ExtensionPrefs* prefs = 80 ExtensionPrefs* prefs =
81 browser()->profile()->GetExtensionService()->extension_prefs(); 81 browser()->profile()->GetExtensionService()->extension_prefs();
82 prefs->AddGrantedPermissions("kjmkgkdkpedkejedfhmfcenooemhbpbo", 82 prefs->AddGrantedPermissions("kjmkgkdkpedkejedfhmfcenooemhbpbo",
83 granted_permissions); 83 granted_permissions.get());
84 84
85 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); 85 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
86 host_resolver()->AddRule("*.com", "127.0.0.1"); 86 host_resolver()->AddRule("*.com", "127.0.0.1");
87 ASSERT_TRUE(StartTestServer()); 87 ASSERT_TRUE(StartTestServer());
88 EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_; 88 EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_;
89 } 89 }
90 90
91 // Tests that the optional permissions API works correctly. 91 // Tests that the optional permissions API works correctly.
92 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsAutoConfirm) { 92 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsAutoConfirm) {
93 // Rather than setting the granted permissions, set the UI autoconfirm flag 93 // Rather than setting the granted permissions, set the UI autoconfirm flag
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 // Test requesting, querying, and removing host permissions for host 156 // Test requesting, querying, and removing host permissions for host
157 // permissions that are a subset of the optional permissions. 157 // permissions that are a subset of the optional permissions.
158 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, HostSubsets) { 158 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, HostSubsets) {
159 PermissionsRequestFunction::SetAutoConfirmForTests(true); 159 PermissionsRequestFunction::SetAutoConfirmForTests(true);
160 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); 160 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
161 EXPECT_TRUE(RunExtensionTest("permissions/host_subsets")) << message_; 161 EXPECT_TRUE(RunExtensionTest("permissions/host_subsets")) << message_;
162 } 162 }
163 163
164 } // namespace extensions 164 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698