OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/prefs/pref_service.h" | 6 #include "chrome/browser/prefs/pref_service.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 "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
11 | 11 |
12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { | 12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { |
13 CommandLine::ForCurrentProcess()->AppendSwitch( | 13 CommandLine::ForCurrentProcess()->AppendSwitch( |
14 switches::kEnableExperimentalExtensionApis); | 14 switches::kEnableExperimentalExtensionApis); |
15 | 15 |
16 PrefService* pref_service = browser()->profile()->GetPrefs(); | 16 PrefService* pref_service = browser()->profile()->GetPrefs(); |
17 pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true); | 17 pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true); |
| 18 pref_service->SetBoolean(prefs::kEnableReferrers, false); |
18 | 19 |
19 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; | 20 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; |
20 | 21 |
21 const PrefService::Preference* pref = pref_service->FindPreference( | 22 const PrefService::Preference* pref = pref_service->FindPreference( |
22 prefs::kBlockThirdPartyCookies); | 23 prefs::kBlockThirdPartyCookies); |
23 ASSERT_TRUE(pref); | 24 ASSERT_TRUE(pref); |
24 EXPECT_TRUE(pref->IsExtensionControlled()); | 25 EXPECT_TRUE(pref->IsExtensionControlled()); |
25 EXPECT_FALSE(pref_service->GetBoolean(prefs::kBlockThirdPartyCookies)); | 26 EXPECT_FALSE(pref_service->GetBoolean(prefs::kBlockThirdPartyCookies)); |
| 27 EXPECT_TRUE(pref_service->GetBoolean(prefs::kEnableReferrers)); |
26 } | 28 } |
27 | 29 |
28 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) { | 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) { |
29 CommandLine::ForCurrentProcess()->AppendSwitch( | 31 CommandLine::ForCurrentProcess()->AppendSwitch( |
30 switches::kEnableExperimentalExtensionApis); | 32 switches::kEnableExperimentalExtensionApis); |
31 | 33 |
32 PrefService* prefs = browser()->profile()->GetPrefs(); | 34 PrefService* prefs = browser()->profile()->GetPrefs(); |
33 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); | 35 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); |
34 | 36 |
35 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) << | 37 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) << |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { | 80 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { |
79 CommandLine::ForCurrentProcess()->AppendSwitch( | 81 CommandLine::ForCurrentProcess()->AppendSwitch( |
80 switches::kEnableExperimentalExtensionApis); | 82 switches::kEnableExperimentalExtensionApis); |
81 | 83 |
82 PrefService* prefs = browser()->profile()->GetPrefs(); | 84 PrefService* prefs = browser()->profile()->GetPrefs(); |
83 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); | 85 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); |
84 | 86 |
85 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << | 87 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << |
86 message_; | 88 message_; |
87 } | 89 } |
OLD | NEW |