OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include <string> | |
6 | |
7 #include "chrome/app/chrome_command_ids.h" | |
8 #include "chrome/browser/net/url_fixer_upper.h" | |
9 #include "chrome/common/url_constants.h" | |
10 #include "chrome/test/automation/automation_proxy.h" | |
11 #include "chrome/test/automation/browser_proxy.h" | |
12 #include "chrome/test/automation/tab_proxy.h" | |
13 #include "chrome/test/ui/ui_test.h" | |
14 #include "net/test/test_server.h" | |
15 | |
16 namespace { | |
17 | |
18 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | |
19 | |
20 } // namespace | |
21 | |
22 typedef UITest CollectedCookiesTest; | |
23 | |
24 // Crashing on Windows, see http://crbug.com/79331 | |
25 #if defined(OS_WIN) | |
26 #define MAYBE_DoubleDisplay DISABLED_DoubleDisplay | |
27 #else | |
28 #define MAYBE_DoubleDisplay DoubleDisplay | |
29 #endif | |
30 TEST_F(CollectedCookiesTest, MAYBE_DoubleDisplay) { | |
31 net::TestServer test_server(net::TestServer::TYPE_HTTP, | |
32 net::TestServer::kLocalhost, | |
33 FilePath(kDocRoot)); | |
34 ASSERT_TRUE(test_server.Start()); | |
35 | |
36 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | |
37 ASSERT_TRUE(browser.get()); | |
38 | |
39 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | |
40 ASSERT_TRUE(tab.get()); | |
41 | |
42 // Disable cookies. | |
43 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | |
44 CONTENT_SETTING_BLOCK)); | |
45 | |
46 // Load a page with cookies. | |
47 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); | |
48 | |
49 // Click on the info link twice. | |
50 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | |
51 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | |
52 } | |
53 | |
54 // Crashing on Windows, see http://crbug.com/79331 | |
55 #if defined(OS_WIN) | |
56 #define MAYBE_NavigateAway DISABLED_NavigateAway | |
57 #else | |
58 #define MAYBE_NavigateAway NavigateAway | |
59 #endif | |
60 TEST_F(CollectedCookiesTest, MAYBE_NavigateAway) { | |
61 net::TestServer test_server(net::TestServer::TYPE_HTTP, | |
62 net::TestServer::kLocalhost, | |
63 FilePath(kDocRoot)); | |
64 ASSERT_TRUE(test_server.Start()); | |
65 | |
66 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | |
67 ASSERT_TRUE(browser.get()); | |
68 | |
69 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | |
70 ASSERT_TRUE(tab.get()); | |
71 | |
72 // Disable cookies. | |
73 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | |
74 CONTENT_SETTING_BLOCK)); | |
75 | |
76 // Load a page with cookies. | |
77 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html"))); | |
78 | |
79 // Click on the info link. | |
80 ASSERT_TRUE(tab->ShowCollectedCookiesDialog()); | |
81 | |
82 // Navigate to another page. | |
83 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie2.html"))); | |
84 } | |
OLD | NEW |