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/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "extensions/browser/extension_prefs.h" | 9 #include "extensions/browser/extension_prefs.h" |
10 #include "extensions/common/permissions/permission_set.h" | 10 #include "extensions/common/permissions/permission_set.h" |
11 #include "extensions/common/switches.h" | 11 #include "extensions/common/switches.h" |
12 #include "net/dns/mock_host_resolver.h" | 12 #include "net/dns/mock_host_resolver.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 static void AddPattern(URLPatternSet* extent, const std::string& pattern) { | 18 static void AddPattern(URLPatternSet* extent, const std::string& pattern) { |
19 int schemes = URLPattern::SCHEME_ALL; | 19 int schemes = URLPattern::SCHEME_ALL; |
20 extent->AddPattern(URLPattern(schemes, pattern)); | 20 extent->AddPattern(URLPattern(schemes, pattern)); |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 class ExperimentalApiTest : public ExtensionApiTest { | 25 class ExperimentalApiTest : public ExtensionApiTest { |
26 public: | 26 public: |
27 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 27 virtual void SetUpCommandLine(CommandLine* command_line) override { |
28 ExtensionApiTest::SetUpCommandLine(command_line); | 28 ExtensionApiTest::SetUpCommandLine(command_line); |
29 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 29 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
30 } | 30 } |
31 }; | 31 }; |
32 | 32 |
33 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PermissionsFail) { | 33 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PermissionsFail) { |
34 ASSERT_TRUE(RunExtensionTest("permissions/disabled")) << message_; | 34 ASSERT_TRUE(RunExtensionTest("permissions/disabled")) << message_; |
35 | 35 |
36 // Since the experimental APIs require a flag, this will fail even though | 36 // Since the experimental APIs require a flag, this will fail even though |
37 // it's enabled. | 37 // it's enabled. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |