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

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

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "net/test/spawned_test_server/spawned_test_server.h" 16 #include "net/test/embedded_test_server/embedded_test_server.h"
17
18 namespace {
19
20 const base::FilePath::CharType kDocRoot[] =
21 FILE_PATH_LITERAL("chrome/test/data");
22
23 } // namespace
24 17
25 typedef InProcessBrowserTest CollectedCookiesTest; 18 typedef InProcessBrowserTest CollectedCookiesTest;
26 19
27 // If this crashes on Windows, use http://crbug.com/79331 20 // If this crashes on Windows, use http://crbug.com/79331
28 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { 21 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) {
29 ASSERT_TRUE(test_server()->Start()); 22 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
30 23
31 // Disable cookies. 24 // Disable cookies.
32 CookieSettings::Factory::GetForProfile(browser()->profile())-> 25 CookieSettings::Factory::GetForProfile(browser()->profile())->
33 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); 26 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
34 27
35 // Load a page with cookies. 28 // Load a page with cookies.
36 ui_test_utils::NavigateToURL( 29 ui_test_utils::NavigateToURL(
37 browser(), test_server()->GetURL("files/cookie1.html")); 30 browser(), embedded_test_server()->GetURL("/cookie1.html"));
38 31
39 // Click on the info link twice. 32 // Click on the info link twice.
40 content::WebContents* web_contents = 33 content::WebContents* web_contents =
41 browser()->tab_strip_model()->GetActiveWebContents(); 34 browser()->tab_strip_model()->GetActiveWebContents();
42 chrome::ShowCollectedCookiesDialog(web_contents); 35 chrome::ShowCollectedCookiesDialog(web_contents);
43 chrome::ShowCollectedCookiesDialog(web_contents); 36 chrome::ShowCollectedCookiesDialog(web_contents);
44 } 37 }
45 38
46 // If this crashes on Windows, use http://crbug.com/79331 39 // If this crashes on Windows, use http://crbug.com/79331
47 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { 40 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) {
48 41
49 // Disable cookies. 42 // Disable cookies.
50 CookieSettings::Factory::GetForProfile(browser()->profile())-> 43 CookieSettings::Factory::GetForProfile(browser()->profile())->
51 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); 44 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
52 45
53 // Load a page with cookies. 46 // Load a page with cookies.
54 ui_test_utils::NavigateToURL( 47 ui_test_utils::NavigateToURL(
55 browser(), test_server()->GetURL("files/cookie1.html")); 48 browser(), embedded_test_server()->GetURL("/cookie1.html"));
56 49
57 // Click on the info link. 50 // Click on the info link.
58 content::WebContents* web_contents = 51 content::WebContents* web_contents =
59 browser()->tab_strip_model()->GetActiveWebContents(); 52 browser()->tab_strip_model()->GetActiveWebContents();
60 chrome::ShowCollectedCookiesDialog(web_contents); 53 chrome::ShowCollectedCookiesDialog(web_contents);
61 54
62 // Navigate to another page. 55 // Navigate to another page.
63 ui_test_utils::NavigateToURL( 56 ui_test_utils::NavigateToURL(
64 browser(), test_server()->GetURL("files/cookie2.html")); 57 browser(), embedded_test_server()->GetURL("/cookie2.html"));
65 } 58 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oobe_browsertest.cc ('k') | chrome/browser/extensions/active_tab_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698