OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 9 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tab_dialogs.h" | 11 #include "chrome/browser/ui/tab_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/browser/ui/test/test_browser_dialog.h" | 13 #include "chrome/browser/ui/test/test_browser_dialog.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
17 #include "components/content_settings/core/browser/cookie_settings.h" | 17 #include "components/content_settings/core/browser/cookie_settings.h" |
18 #include "net/test/embedded_test_server/embedded_test_server.h" | 18 #include "net/test/embedded_test_server/embedded_test_server.h" |
19 #include "ui/base/ui_base_switches.h" | 19 #include "ui/base/ui_base_switches.h" |
20 | 20 |
21 class CollectedCookiesTest : public DialogBrowserTest { | 21 class CollectedCookiesTest : public DialogBrowserTest { |
22 public: | 22 public: |
23 CollectedCookiesTest() {} | 23 CollectedCookiesTest() {} |
24 | 24 |
25 // DialogBrowserTest: | 25 // TestDialogInterface: |
26 void ShowDialog(const std::string& name) override { | 26 void ShowDialog(const std::string& name) override { |
27 ASSERT_TRUE(embedded_test_server()->Start()); | 27 ASSERT_TRUE(embedded_test_server()->Start()); |
28 | 28 |
29 // Disable cookies. | 29 // Disable cookies. |
30 CookieSettingsFactory::GetForProfile(browser()->profile()) | 30 CookieSettingsFactory::GetForProfile(browser()->profile()) |
31 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); | 31 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); |
32 | 32 |
33 // Load a page with cookies. | 33 // Load a page with cookies. |
34 ui_test_utils::NavigateToURL( | 34 ui_test_utils::NavigateToURL( |
35 browser(), embedded_test_server()->GetURL("/cookie1.html")); | 35 browser(), embedded_test_server()->GetURL("/cookie1.html")); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 // If this crashes on Windows, use http://crbug.com/79331 | 78 // If this crashes on Windows, use http://crbug.com/79331 |
79 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { | 79 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { |
80 ShowDialog(std::string()); | 80 ShowDialog(std::string()); |
81 | 81 |
82 // Navigate to another page. | 82 // Navigate to another page. |
83 ui_test_utils::NavigateToURL( | 83 ui_test_utils::NavigateToURL( |
84 browser(), embedded_test_server()->GetURL("/cookie2.html")); | 84 browser(), embedded_test_server()->GetURL("/cookie2.html")); |
85 } | 85 } |
OLD | NEW |