Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/collected_cookies_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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/content_settings/cookie_settings.h" 8 #include "chrome/browser/content_settings/cookie_settings.h"
9 #include "chrome/browser/net/url_fixer_upper.h" 9 #include "chrome/browser/net/url_fixer_upper.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_dialogs.h" 11 #include "chrome/browser/ui/browser_dialogs.h"
12 #include "chrome/browser/ui/browser_tabstrip.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
16 #include "net/test/test_server.h" 17 #include "net/test/test_server.h"
17 18
18 namespace { 19 namespace {
19 20
20 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); 21 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
21 22
22 } // namespace 23 } // namespace
23 24
24 typedef InProcessBrowserTest CollectedCookiesTest; 25 typedef InProcessBrowserTest CollectedCookiesTest;
25 26
26 // If this crashes on Windows, use http://crbug.com/79331 27 // If this crashes on Windows, use http://crbug.com/79331
27 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { 28 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) {
28 ASSERT_TRUE(test_server()->Start()); 29 ASSERT_TRUE(test_server()->Start());
29 30
30 // Disable cookies. 31 // Disable cookies.
31 CookieSettings::Factory::GetForProfile(browser()->profile())-> 32 CookieSettings::Factory::GetForProfile(browser()->profile())->
32 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); 33 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
33 34
34 // Load a page with cookies. 35 // Load a page with cookies.
35 ui_test_utils::NavigateToURL( 36 ui_test_utils::NavigateToURL(
36 browser(), test_server()->GetURL("files/cookie1.html")); 37 browser(), test_server()->GetURL("files/cookie1.html"));
37 38
38 // Click on the info link twice. 39 // Click on the info link twice.
39 TabContents* tab_contents = browser()->GetActiveTabContents(); 40 TabContents* tab_contents = chrome::GetActiveTabContents(browser());
40 browser::ShowCollectedCookiesDialog(tab_contents); 41 browser::ShowCollectedCookiesDialog(tab_contents);
41 browser::ShowCollectedCookiesDialog(tab_contents); 42 browser::ShowCollectedCookiesDialog(tab_contents);
42 } 43 }
43 44
44 // If this crashes on Windows, use http://crbug.com/79331 45 // If this crashes on Windows, use http://crbug.com/79331
45 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { 46 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) {
46 47
47 // Disable cookies. 48 // Disable cookies.
48 CookieSettings::Factory::GetForProfile(browser()->profile())-> 49 CookieSettings::Factory::GetForProfile(browser()->profile())->
49 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); 50 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
50 51
51 // Load a page with cookies. 52 // Load a page with cookies.
52 ui_test_utils::NavigateToURL( 53 ui_test_utils::NavigateToURL(
53 browser(), test_server()->GetURL("files/cookie1.html")); 54 browser(), test_server()->GetURL("files/cookie1.html"));
54 55
55 // Click on the info link. 56 // Click on the info link.
56 TabContents* tab_contents = browser()->GetActiveTabContents(); 57 TabContents* tab_contents = chrome::GetActiveTabContents(browser());
57 browser::ShowCollectedCookiesDialog(tab_contents); 58 browser::ShowCollectedCookiesDialog(tab_contents);
58 59
59 // Navigate to another page. 60 // Navigate to another page.
60 ui_test_utils::NavigateToURL( 61 ui_test_utils::NavigateToURL(
61 browser(), test_server()->GetURL("files/cookie2.html")); 62 browser(), test_server()->GetURL("files/cookie2.html"));
62 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698