| 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 "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" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/extensions/permissions/permission_set.h" | 12 #include "chrome/common/extensions/permissions/permission_set.h" |
| 13 #include "net/base/mock_host_resolver.h" | 13 #include "net/base/mock_host_resolver.h" |
| 14 | 14 |
| 15 using extensions::APIPermission; | 15 using extensions::APIPermission; |
| 16 using extensions::APIPermissionSet; | 16 using extensions::APIPermissionSet; |
| 17 using extensions::PermissionSet; | 17 using extensions::PermissionSet; |
| 18 using extensions::URLPatternSet; |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 static void AddPattern(URLPatternSet* extent, const std::string& pattern) { | 22 static void AddPattern(URLPatternSet* extent, const std::string& pattern) { |
| 22 int schemes = URLPattern::SCHEME_ALL; | 23 int schemes = URLPattern::SCHEME_ALL; |
| 23 extent->AddPattern(URLPattern(schemes, pattern)); | 24 extent->AddPattern(URLPattern(schemes, pattern)); |
| 24 } | 25 } |
| 25 | 26 |
| 26 } // namespace | 27 } // namespace |
| 27 | 28 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 112 } |
| 112 | 113 |
| 113 // Tests that the permissions.request function must be called from within a | 114 // Tests that the permissions.request function must be called from within a |
| 114 // user gesture. | 115 // user gesture. |
| 115 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) { | 116 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) { |
| 116 RequestPermissionsFunction::SetIgnoreUserGestureForTests(false); | 117 RequestPermissionsFunction::SetIgnoreUserGestureForTests(false); |
| 117 host_resolver()->AddRule("*.com", "127.0.0.1"); | 118 host_resolver()->AddRule("*.com", "127.0.0.1"); |
| 118 ASSERT_TRUE(StartTestServer()); | 119 ASSERT_TRUE(StartTestServer()); |
| 119 EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_; | 120 EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_; |
| 120 } | 121 } |
| OLD | NEW |