| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/test/automation/tab_proxy.h" | 11 #include "chrome/test/automation/tab_proxy.h" |
| 12 #include "chrome/test/automation/browser_proxy.h" | 12 #include "chrome/test/automation/browser_proxy.h" |
| 13 #include "chrome/test/ui/ui_test.h" | 13 #include "chrome/test/ui/ui_test.h" |
| 14 #include "net/url_request/url_request_unittest.h" | 14 #include "net/url_request/url_request_unittest.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const wchar_t kDocRoot[] = L"chrome/test/data"; | 18 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 typedef UITest CollectedCookiesTest; | 22 typedef UITest CollectedCookiesTest; |
| 23 | 23 |
| 24 // Test is flaky. http://crbug.com/49539 | 24 // Test is flaky. http://crbug.com/49539 |
| 25 TEST_F(CollectedCookiesTest, FLAKY_DoubleDisplay) { | 25 TEST_F(CollectedCookiesTest, FLAKY_DoubleDisplay) { |
| 26 scoped_refptr<HTTPTestServer> server = | 26 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
| 27 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
| 28 ASSERT_TRUE(NULL != server.get()); | 27 ASSERT_TRUE(NULL != server.get()); |
| 29 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 30 ASSERT_TRUE(browser.get()); | 29 ASSERT_TRUE(browser.get()); |
| 31 | 30 |
| 32 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 31 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 33 ASSERT_TRUE(tab.get()); | 32 ASSERT_TRUE(tab.get()); |
| 34 | 33 |
| 35 // Disable cookies. | 34 // Disable cookies. |
| 36 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 35 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 37 CONTENT_SETTING_BLOCK)); | 36 CONTENT_SETTING_BLOCK)); |
| 38 | 37 |
| 39 // Load a page with cookies. | 38 // Load a page with cookies. |
| 40 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie1.html"))); | 39 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie1.html"))); |
| 41 | 40 |
| 42 // Click on the info link twice. | 41 // Click on the info link twice. |
| 43 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 42 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 44 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 43 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 45 } | 44 } |
| 46 | 45 |
| 47 // Test is flaky. http://crbug.com/49539 | 46 // Test is flaky. http://crbug.com/49539 |
| 48 TEST_F(CollectedCookiesTest, FLAKY_NavigateAway) { | 47 TEST_F(CollectedCookiesTest, FLAKY_NavigateAway) { |
| 49 scoped_refptr<HTTPTestServer> server = | 48 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
| 50 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
| 51 ASSERT_TRUE(NULL != server.get()); | 49 ASSERT_TRUE(NULL != server.get()); |
| 52 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 50 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 53 ASSERT_TRUE(browser.get()); | 51 ASSERT_TRUE(browser.get()); |
| 54 | 52 |
| 55 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 53 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 56 ASSERT_TRUE(tab.get()); | 54 ASSERT_TRUE(tab.get()); |
| 57 | 55 |
| 58 // Disable cookies. | 56 // Disable cookies. |
| 59 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 57 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 60 CONTENT_SETTING_BLOCK)); | 58 CONTENT_SETTING_BLOCK)); |
| 61 | 59 |
| 62 // Load a page with cookies. | 60 // Load a page with cookies. |
| 63 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie1.html"))); | 61 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie1.html"))); |
| 64 | 62 |
| 65 // Click on the info link. | 63 // Click on the info link. |
| 66 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 64 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 67 | 65 |
| 68 // Navigate to another page. | 66 // Navigate to another page. |
| 69 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie2.html"))); | 67 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/cookie2.html"))); |
| 70 } | 68 } |
| OLD | NEW |