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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/content_settings/cookie_settings.h" | 7 #include "chrome/browser/content_settings/cookie_settings.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" | 9 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "content/public/browser/plugin_service.h" | 15 #include "content/public/browser/plugin_service.h" |
16 #include "content/public/common/webplugininfo.h" | 16 #include "content/public/common/webplugininfo.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { | 20 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { |
21 CommandLine::ForCurrentProcess()->AppendSwitch( | |
22 switches::kEnableExperimentalExtensionApis); | |
23 | |
24 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; | 21 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; |
25 | 22 |
26 HostContentSettingsMap* map = | 23 HostContentSettingsMap* map = |
27 browser()->profile()->GetHostContentSettingsMap(); | 24 browser()->profile()->GetHostContentSettingsMap(); |
28 CookieSettings* cookie_settings = | 25 CookieSettings* cookie_settings = |
29 CookieSettings::Factory::GetForProfile(browser()->profile()).get(); | 26 CookieSettings::Factory::GetForProfile(browser()->profile()).get(); |
30 | 27 |
31 // Check default content settings by using an unknown URL. | 28 // Check default content settings by using an unknown URL. |
32 GURL example_url("http://www.example.com"); | 29 GURL example_url("http://www.example.com"); |
33 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed( | 30 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 90 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
94 map->GetContentSetting( | 91 map->GetContentSetting( |
95 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); | 92 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
96 } | 93 } |
97 | 94 |
98 class ContentSettingsGetResourceIdentifiersTest : public ExtensionApiTest { | 95 class ContentSettingsGetResourceIdentifiersTest : public ExtensionApiTest { |
99 public: | 96 public: |
100 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 97 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
101 ExtensionApiTest::SetUpCommandLine(command_line); | 98 ExtensionApiTest::SetUpCommandLine(command_line); |
102 command_line->AppendSwitch(switches::kDisablePluginsDiscovery); | 99 command_line->AppendSwitch(switches::kDisablePluginsDiscovery); |
103 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | |
104 } | 100 } |
105 }; | 101 }; |
106 | 102 |
107 // Flaky on the trybots. See http://crbug.com/96725. | 103 // Flaky on the trybots. See http://crbug.com/96725. |
108 IN_PROC_BROWSER_TEST_F(ContentSettingsGetResourceIdentifiersTest, | 104 IN_PROC_BROWSER_TEST_F(ContentSettingsGetResourceIdentifiersTest, |
109 DISABLED_Test) { | 105 DISABLED_Test) { |
110 base::FilePath::CharType kFooPath[] = | 106 base::FilePath::CharType kFooPath[] = |
111 FILE_PATH_LITERAL("/plugins/foo.plugin"); | 107 FILE_PATH_LITERAL("/plugins/foo.plugin"); |
112 base::FilePath::CharType kBarPath[] = | 108 base::FilePath::CharType kBarPath[] = |
113 FILE_PATH_LITERAL("/plugins/bar.plugin"); | 109 FILE_PATH_LITERAL("/plugins/bar.plugin"); |
(...skipping 11 matching lines...) Expand all Loading... |
125 base::FilePath(kBarPath), | 121 base::FilePath(kBarPath), |
126 ASCIIToUTF16("2.3.4"), | 122 ASCIIToUTF16("2.3.4"), |
127 ASCIIToUTF16("bar")), | 123 ASCIIToUTF16("bar")), |
128 false); | 124 false); |
129 | 125 |
130 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) | 126 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) |
131 << message_; | 127 << message_; |
132 } | 128 } |
133 | 129 |
134 } // namespace extensions | 130 } // namespace extensions |
OLD | NEW |