| 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_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
| 11 #include "chrome/test/automation/browser_proxy.h" | 11 #include "chrome/test/automation/browser_proxy.h" |
| 12 #include "chrome/test/ui/ui_test.h" | 12 #include "chrome/test/ui/ui_test.h" |
| 13 #include "net/test/test_server.h" | 13 #include "net/test/test_server.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | 17 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 typedef UITest CollectedCookiesTest; | 21 typedef UITest CollectedCookiesTest; |
| 22 | 22 |
| 23 // Flaky, http://crbug.com/62311. | 23 TEST_F(CollectedCookiesTest, DoubleDisplay) { |
| 24 TEST_F(CollectedCookiesTest, FLAKY_DoubleDisplay) { | |
| 25 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); | 24 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); |
| 26 ASSERT_TRUE(test_server.Start()); | 25 ASSERT_TRUE(test_server.Start()); |
| 27 | 26 |
| 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 27 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 29 ASSERT_TRUE(browser.get()); | 28 ASSERT_TRUE(browser.get()); |
| 30 | 29 |
| 31 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 30 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 32 ASSERT_TRUE(tab.get()); | 31 ASSERT_TRUE(tab.get()); |
| 33 | 32 |
| 34 // Disable cookies. | 33 // Disable cookies. |
| 35 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 34 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 36 CONTENT_SETTING_BLOCK)); | 35 CONTENT_SETTING_BLOCK)); |
| 37 | 36 |
| 38 // Load a page with cookies. | 37 // Load a page with cookies. |
| 39 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); | 38 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); |
| 40 | 39 |
| 41 // Click on the info link twice. | 40 // Click on the info link twice. |
| 42 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 41 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 43 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 42 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 44 } | 43 } |
| 45 | 44 |
| 46 // Flaky, http://crbug.com/62311. | 45 TEST_F(CollectedCookiesTest, NavigateAway) { |
| 47 TEST_F(CollectedCookiesTest, FLAKY_NavigateAway) { | |
| 48 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); | 46 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); |
| 49 ASSERT_TRUE(test_server.Start()); | 47 ASSERT_TRUE(test_server.Start()); |
| 50 | 48 |
| 51 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 49 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 52 ASSERT_TRUE(browser.get()); | 50 ASSERT_TRUE(browser.get()); |
| 53 | 51 |
| 54 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 52 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 55 ASSERT_TRUE(tab.get()); | 53 ASSERT_TRUE(tab.get()); |
| 56 | 54 |
| 57 // Disable cookies. | 55 // Disable cookies. |
| 58 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 56 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 59 CONTENT_SETTING_BLOCK)); | 57 CONTENT_SETTING_BLOCK)); |
| 60 | 58 |
| 61 // Load a page with cookies. | 59 // Load a page with cookies. |
| 62 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); | 60 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); |
| 63 | 61 |
| 64 // Click on the info link. | 62 // Click on the info link. |
| 65 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | 63 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); |
| 66 | 64 |
| 67 // Navigate to another page. | 65 // Navigate to another page. |
| 68 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie2.html"))); | 66 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie2.html"))); |
| 69 } | 67 } |
| OLD | NEW |