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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void Basic(const GURL& url) { | 84 void Basic(const GURL& url) { |
85 TabContents* tab = chrome::GetActiveTabContents(browser()); | 85 TabContents* tab = chrome::GetActiveTabContents(browser()); |
86 ASSERT_FALSE(GetCookies(tab->profile(), url).empty()); | 86 ASSERT_FALSE(GetCookies(tab->profile(), url).empty()); |
87 } | 87 } |
88 | 88 |
89 net::TestServer https_server_; | 89 net::TestServer https_server_; |
90 }; | 90 }; |
91 | 91 |
| 92 // Timing out on Mac ASAN. http://crbug.com/145000 |
| 93 #if !defined(OS_MACOSX) && !defined(ADDRESS_SANITIZER) |
| 94 |
92 // Sanity check on cookies before we do other tests. While these can be written | 95 // Sanity check on cookies before we do other tests. While these can be written |
93 // in content_browsertests, we want to verify Chrome's cookie storage and how it | 96 // in content_browsertests, we want to verify Chrome's cookie storage and how it |
94 // handles incognito windows. | 97 // handles incognito windows. |
95 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookies) { | 98 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookies) { |
96 ASSERT_TRUE(test_server()->Start()); | 99 ASSERT_TRUE(test_server()->Start()); |
97 GURL http_url = test_server()->GetURL("files/setcookie.html"); | 100 GURL http_url = test_server()->GetURL("files/setcookie.html"); |
98 PreBasic(http_url); | 101 PreBasic(http_url); |
99 } | 102 } |
100 | 103 |
101 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookies) { | 104 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookies) { |
(...skipping 26 matching lines...) Expand all Loading... |
128 } | 131 } |
129 | 132 |
130 // Ensure that the setting persists. | 133 // Ensure that the setting persists. |
131 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BlockCookies) { | 134 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BlockCookies) { |
132 ASSERT_EQ( | 135 ASSERT_EQ( |
133 CONTENT_SETTING_BLOCK, | 136 CONTENT_SETTING_BLOCK, |
134 CookieSettings::Factory::GetForProfile(browser()->profile())-> | 137 CookieSettings::Factory::GetForProfile(browser()->profile())-> |
135 GetDefaultCookieSetting(NULL)); | 138 GetDefaultCookieSetting(NULL)); |
136 } | 139 } |
137 | 140 |
| 141 #endif // !defined(OS_MACOSX) && !defined(ADDRESS_SANITIZER) |
| 142 |
138 // Verify that cookies can be allowed and set using exceptions for particular | 143 // Verify that cookies can be allowed and set using exceptions for particular |
139 // website(s) when all others are blocked. | 144 // website(s) when all others are blocked. |
140 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, AllowCookiesUsingExceptions) { | 145 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, AllowCookiesUsingExceptions) { |
141 ASSERT_TRUE(test_server()->Start()); | 146 ASSERT_TRUE(test_server()->Start()); |
142 GURL url = test_server()->GetURL("files/setcookie.html"); | 147 GURL url = test_server()->GetURL("files/setcookie.html"); |
143 CookieSettings* settings = | 148 CookieSettings* settings = |
144 CookieSettings::Factory::GetForProfile(browser()->profile()); | 149 CookieSettings::Factory::GetForProfile(browser()->profile()); |
145 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); | 150 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); |
146 | 151 |
147 ui_test_utils::NavigateToURL(browser(), url); | 152 ui_test_utils::NavigateToURL(browser(), url); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 359 |
355 content::RenderViewHost* host = | 360 content::RenderViewHost* host = |
356 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 361 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
357 host->Send(new ChromeViewMsg_LoadBlockedPlugins( | 362 host->Send(new ChromeViewMsg_LoadBlockedPlugins( |
358 host->GetRoutingID(), std::string())); | 363 host->GetRoutingID(), std::string())); |
359 | 364 |
360 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 365 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
361 } | 366 } |
362 | 367 |
363 #endif // !defined(USE_AURA) | 368 #endif // !defined(USE_AURA) |
OLD | NEW |