OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/content_settings/cookie_settings_factory.h" | 5 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
6 #include "chrome/browser/infobars/infobar_service.h" | 6 #include "chrome/browser/infobars/infobar_service.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/views/collected_cookies_views.h" | 9 #include "chrome/browser/ui/views/collected_cookies_views.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "components/content_settings/core/browser/cookie_settings.h" | 12 #include "components/content_settings/core/browser/cookie_settings.h" |
13 #include "net/test/embedded_test_server/embedded_test_server.h" | 13 #include "net/test/embedded_test_server/embedded_test_server.h" |
14 | 14 |
15 class CollectedCookiesViewsTest : public InProcessBrowserTest { | 15 class CollectedCookiesViewsTest : public InProcessBrowserTest { |
16 public: | 16 public: |
17 void SetUpOnMainThread() override { | 17 void SetUpOnMainThread() override { |
18 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 18 ASSERT_TRUE(embedded_test_server()->Start()); |
19 | 19 |
20 // Disable cookies. | 20 // Disable cookies. |
21 CookieSettingsFactory::GetForProfile(browser()->profile()) | 21 CookieSettingsFactory::GetForProfile(browser()->profile()) |
22 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); | 22 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); |
23 | 23 |
24 // Load a page with cookies. | 24 // Load a page with cookies. |
25 ui_test_utils::NavigateToURL( | 25 ui_test_utils::NavigateToURL( |
26 browser(), embedded_test_server()->GetURL("/cookie1.html")); | 26 browser(), embedded_test_server()->GetURL("/cookie1.html")); |
27 | 27 |
28 // Spawn a cookies dialog. Note that |cookies_dialog_| will delete itself | 28 // Spawn a cookies dialog. Note that |cookies_dialog_| will delete itself |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Test closing tab after changing dialog data. Changed dialog should not | 77 // Test closing tab after changing dialog data. Changed dialog should not |
78 // show infobar or crash because InfoBarService is gone. | 78 // show infobar or crash because InfoBarService is gone. |
79 | 79 |
80 SetDialogChanged(); | 80 SetDialogChanged(); |
81 | 81 |
82 // Closing the owning tab will close dialog. | 82 // Closing the owning tab will close dialog. |
83 browser()->tab_strip_model()->GetActiveWebContents()->Close(); | 83 browser()->tab_strip_model()->GetActiveWebContents()->Close(); |
84 | 84 |
85 EXPECT_EQ(0u, infobar_count()); | 85 EXPECT_EQ(0u, infobar_count()); |
86 } | 86 } |
OLD | NEW |