Return backed up TemplateURL on default search change
[chromium-blink-merge.git] / chrome / browser / collected_cookies_uitest.cc
blob0612a09a5ab7bb5fa4d321d6da85a505fbc0f635
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
3 // found in the LICENSE file.
5 #include <string>
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"
16 namespace {
18 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
20 } // namespace
22 typedef UITest CollectedCookiesTest;
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, FilePath(kDocRoot));
32 ASSERT_TRUE(test_server.Start());
34 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
35 ASSERT_TRUE(browser.get());
37 scoped_refptr<TabProxy> tab(browser->GetTab(0));
38 ASSERT_TRUE(tab.get());
40 // Disable cookies.
41 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
42 CONTENT_SETTING_BLOCK));
44 // Load a page with cookies.
45 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html")));
47 // Click on the info link twice.
48 ASSERT_TRUE(tab->ShowCollectedCookiesDialog());
49 ASSERT_TRUE(tab->ShowCollectedCookiesDialog());
52 // Crashing on Windows, see http://crbug.com/79331
53 #if defined(OS_WIN)
54 #define MAYBE_NavigateAway DISABLED_NavigateAway
55 #else
56 #define MAYBE_NavigateAway NavigateAway
57 #endif
58 TEST_F(CollectedCookiesTest, MAYBE_NavigateAway) {
59 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot));
60 ASSERT_TRUE(test_server.Start());
62 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
63 ASSERT_TRUE(browser.get());
65 scoped_refptr<TabProxy> tab(browser->GetTab(0));
66 ASSERT_TRUE(tab.get());
68 // Disable cookies.
69 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
70 CONTENT_SETTING_BLOCK));
72 // Load a page with cookies.
73 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie1.html")));
75 // Click on the info link.
76 ASSERT_TRUE(tab->ShowCollectedCookiesDialog());
78 // Navigate to another page.
79 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/cookie2.html")));