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

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

Issue 10920070: Remove permission warnings from most tabs and windows APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // permissions). 66 // permissions).
67 // Disabled: http://crbug.com/125193 67 // Disabled: http://crbug.com/125193
68 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_AlwaysAllowed) { 68 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_AlwaysAllowed) {
69 ASSERT_TRUE(RunExtensionTest("permissions/always_allowed")) << message_; 69 ASSERT_TRUE(RunExtensionTest("permissions/always_allowed")) << message_;
70 } 70 }
71 71
72 // Tests that the optional permissions API works correctly. 72 // Tests that the optional permissions API works correctly.
73 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGranted) { 73 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGranted) {
74 // Mark all the tested APIs as granted to bypass the confirmation UI. 74 // Mark all the tested APIs as granted to bypass the confirmation UI.
75 APIPermissionSet apis; 75 APIPermissionSet apis;
76 apis.insert(APIPermission::kTab); 76 apis.insert(APIPermission::kBookmark);
77 URLPatternSet explicit_hosts; 77 URLPatternSet explicit_hosts;
78 AddPattern(&explicit_hosts, "http://*.c.com/*"); 78 AddPattern(&explicit_hosts, "http://*.c.com/*");
79 scoped_refptr<PermissionSet> granted_permissions = 79 scoped_refptr<PermissionSet> granted_permissions =
80 new PermissionSet(apis, explicit_hosts, URLPatternSet()); 80 new PermissionSet(apis, explicit_hosts, URLPatternSet());
81 81
82 extensions::ExtensionPrefs* prefs = 82 extensions::ExtensionPrefs* prefs =
83 browser()->profile()->GetExtensionService()->extension_prefs(); 83 browser()->profile()->GetExtensionService()->extension_prefs();
84 prefs->AddGrantedPermissions("kjmkgkdkpedkejedfhmfcenooemhbpbo", 84 prefs->AddGrantedPermissions("kjmkgkdkpedkejedfhmfcenooemhbpbo",
85 granted_permissions); 85 granted_permissions);
86 86
(...skipping 24 matching lines...) Expand all
111 } 111 }
112 112
113 // Tests that the permissions.request function must be called from within a 113 // Tests that the permissions.request function must be called from within a
114 // user gesture. 114 // user gesture.
115 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) { 115 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) {
116 RequestPermissionsFunction::SetIgnoreUserGestureForTests(false); 116 RequestPermissionsFunction::SetIgnoreUserGestureForTests(false);
117 host_resolver()->AddRule("*.com", "127.0.0.1"); 117 host_resolver()->AddRule("*.com", "127.0.0.1");
118 ASSERT_TRUE(StartTestServer()); 118 ASSERT_TRUE(StartTestServer());
119 EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_; 119 EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_;
120 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698