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 |
43 PrefService* otr_prefs = | 45 PrefService* otr_prefs = |
44 browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); | 46 browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); |
45 const PrefService::Preference* pref = | 47 const PrefService::Preference* pref = |
46 otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies); | 48 otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies); |
47 ASSERT_TRUE(pref); | 49 ASSERT_TRUE(pref); |
48 EXPECT_TRUE(pref->IsExtensionControlled()); | 50 EXPECT_TRUE(pref->IsExtensionControlled()); |
49 EXPECT_TRUE(otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 51 EXPECT_TRUE(otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
50 | 52 |
51 pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies); | 53 pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies); |
52 ASSERT_TRUE(pref); | 54 ASSERT_TRUE(pref); |
53 EXPECT_FALSE(pref->IsExtensionControlled()); | 55 EXPECT_FALSE(pref->IsExtensionControlled()); |
54 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 56 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
| 57 #endif |
55 } | 58 } |
56 | 59 |
57 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledContentSettings) { | 60 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledContentSettings) { |
58 CommandLine::ForCurrentProcess()->AppendSwitch( | 61 CommandLine::ForCurrentProcess()->AppendSwitch( |
59 switches::kEnableExperimentalExtensionApis); | 62 switches::kEnableExperimentalExtensionApis); |
60 | 63 |
61 EXPECT_FALSE(RunExtensionTest("content_settings/incognito")); | 64 EXPECT_FALSE(RunExtensionTest("content_settings/incognito")); |
62 } | 65 } |
63 | 66 |
64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsClear) { | 67 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsClear) { |
(...skipping 15 matching lines...) Expand all Loading... |
80 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { | 83 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { |
81 CommandLine::ForCurrentProcess()->AppendSwitch( | 84 CommandLine::ForCurrentProcess()->AppendSwitch( |
82 switches::kEnableExperimentalExtensionApis); | 85 switches::kEnableExperimentalExtensionApis); |
83 | 86 |
84 PrefService* prefs = browser()->profile()->GetPrefs(); | 87 PrefService* prefs = browser()->profile()->GetPrefs(); |
85 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); | 88 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); |
86 | 89 |
87 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << | 90 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << |
88 message_; | 91 message_; |
89 } | 92 } |
OLD | NEW |