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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 PrefService* prefs = browser()->profile()->GetPrefs(); | 34 PrefService* prefs = browser()->profile()->GetPrefs(); |
35 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); | 35 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); |
36 | 36 |
37 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) << | 37 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) << |
38 message_; | 38 message_; |
39 | 39 |
40 // Setting an incognito preference should not create an incognito profile. | 40 // Setting an incognito preference should not create an incognito profile. |
41 EXPECT_FALSE(browser()->profile()->HasOffTheRecordProfile()); | 41 EXPECT_FALSE(browser()->profile()->HasOffTheRecordProfile()); |
42 | 42 |
43 // TODO(battre): re-enable when incognito is available again. | |
44 #if 0 | |
45 PrefService* otr_prefs = | 43 PrefService* otr_prefs = |
46 browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); | 44 browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); |
47 const PrefService::Preference* pref = | 45 const PrefService::Preference* pref = |
48 otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies); | 46 otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies); |
49 ASSERT_TRUE(pref); | 47 ASSERT_TRUE(pref); |
50 EXPECT_TRUE(pref->IsExtensionControlled()); | 48 EXPECT_TRUE(pref->IsExtensionControlled()); |
51 EXPECT_TRUE(otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 49 EXPECT_TRUE(otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
52 | 50 |
53 pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies); | 51 pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies); |
54 ASSERT_TRUE(pref); | 52 ASSERT_TRUE(pref); |
55 EXPECT_FALSE(pref->IsExtensionControlled()); | 53 EXPECT_FALSE(pref->IsExtensionControlled()); |
56 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 54 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
57 #endif | |
58 } | 55 } |
59 | 56 |
60 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledContentSettings) { | 57 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledContentSettings) { |
61 CommandLine::ForCurrentProcess()->AppendSwitch( | 58 CommandLine::ForCurrentProcess()->AppendSwitch( |
62 switches::kEnableExperimentalExtensionApis); | 59 switches::kEnableExperimentalExtensionApis); |
63 | 60 |
64 EXPECT_FALSE(RunExtensionTest("content_settings/incognito")); | 61 EXPECT_FALSE(RunExtensionTest("content_settings/incognito")); |
65 } | 62 } |
66 | 63 |
67 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsClear) { | 64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsClear) { |
(...skipping 15 matching lines...) Expand all Loading... |
83 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { | 80 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { |
84 CommandLine::ForCurrentProcess()->AppendSwitch( | 81 CommandLine::ForCurrentProcess()->AppendSwitch( |
85 switches::kEnableExperimentalExtensionApis); | 82 switches::kEnableExperimentalExtensionApis); |
86 | 83 |
87 PrefService* prefs = browser()->profile()->GetPrefs(); | 84 PrefService* prefs = browser()->profile()->GetPrefs(); |
88 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); | 85 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); |
89 | 86 |
90 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << | 87 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << |
91 message_; | 88 message_; |
92 } | 89 } |
OLD | NEW |