blob: e662b388ccc3e0af454bde239cc201d7d42c8ca1 [file] [log] [blame]
[email protected]0ea5b7c1c2012-05-15 15:52:331// 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/content_settings/cookie_settings.h"
[email protected]0ea5b7c1c2012-05-15 15:52:339#include "chrome/browser/ui/browser.h"
[email protected]1f0b50b2012-06-22 20:37:1610#include "chrome/browser/ui/browser_dialogs.h"
[email protected]cc872372013-01-28 21:57:0711#include "chrome/browser/ui/tabs/tab_strip_model.h"
[email protected]4f3b4462013-07-27 19:20:1812#include "chrome/common/net/url_fixer_upper.h"
[email protected]0ea5b7c1c2012-05-15 15:52:3313#include "chrome/common/url_constants.h"
14#include "chrome/test/base/in_process_browser_test.h"
15#include "chrome/test/base/ui_test_utils.h"
[email protected]c1dffe82013-06-26 20:59:0516#include "net/test/embedded_test_server/embedded_test_server.h"
[email protected]0ea5b7c1c2012-05-15 15:52:3317
18typedef InProcessBrowserTest CollectedCookiesTest;
19
20// If this crashes on Windows, use http://crbug.com/79331
21IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) {
[email protected]c1dffe82013-06-26 20:59:0522 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
[email protected]0ea5b7c1c2012-05-15 15:52:3323
24 // Disable cookies.
25 CookieSettings::Factory::GetForProfile(browser()->profile())->
26 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
27
28 // Load a page with cookies.
29 ui_test_utils::NavigateToURL(
[email protected]c1dffe82013-06-26 20:59:0530 browser(), embedded_test_server()->GetURL("/cookie1.html"));
[email protected]0ea5b7c1c2012-05-15 15:52:3331
32 // Click on the info link twice.
[email protected]cc872372013-01-28 21:57:0733 content::WebContents* web_contents =
34 browser()->tab_strip_model()->GetActiveWebContents();
[email protected]b95f1842012-10-19 22:34:1535 chrome::ShowCollectedCookiesDialog(web_contents);
36 chrome::ShowCollectedCookiesDialog(web_contents);
[email protected]0ea5b7c1c2012-05-15 15:52:3337}
38
39// If this crashes on Windows, use http://crbug.com/79331
40IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) {
[email protected]32aabdf2013-10-02 10:10:0441 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
[email protected]0ea5b7c1c2012-05-15 15:52:3342
43 // Disable cookies.
44 CookieSettings::Factory::GetForProfile(browser()->profile())->
45 SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
46
47 // Load a page with cookies.
48 ui_test_utils::NavigateToURL(
[email protected]c1dffe82013-06-26 20:59:0549 browser(), embedded_test_server()->GetURL("/cookie1.html"));
[email protected]0ea5b7c1c2012-05-15 15:52:3350
51 // Click on the info link.
[email protected]cc872372013-01-28 21:57:0752 content::WebContents* web_contents =
53 browser()->tab_strip_model()->GetActiveWebContents();
[email protected]b95f1842012-10-19 22:34:1554 chrome::ShowCollectedCookiesDialog(web_contents);
[email protected]0ea5b7c1c2012-05-15 15:52:3355
56 // Navigate to another page.
57 ui_test_utils::NavigateToURL(
[email protected]c1dffe82013-06-26 20:59:0558 browser(), embedded_test_server()->GetURL("/cookie2.html"));
[email protected]0ea5b7c1c2012-05-15 15:52:3359}