OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(CloseObserver); | 110 DISALLOW_COPY_AND_ASSIGN(CloseObserver); |
111 }; | 111 }; |
112 | 112 |
113 class PopupBlockerBrowserTest : public InProcessBrowserTest { | 113 class PopupBlockerBrowserTest : public InProcessBrowserTest { |
114 public: | 114 public: |
115 PopupBlockerBrowserTest() {} | 115 PopupBlockerBrowserTest() {} |
116 ~PopupBlockerBrowserTest() override {} | 116 ~PopupBlockerBrowserTest() override {} |
117 | 117 |
118 void SetUpOnMainThread() override { | 118 void SetUpOnMainThread() override { |
119 InProcessBrowserTest::SetUpOnMainThread(); | |
120 | |
121 host_resolver()->AddRule("*", "127.0.0.1"); | 119 host_resolver()->AddRule("*", "127.0.0.1"); |
122 ASSERT_TRUE(embedded_test_server()->Start()); | 120 ASSERT_TRUE(embedded_test_server()->Start()); |
123 } | 121 } |
124 | 122 |
125 int GetBlockedContentsCount() { | 123 int GetBlockedContentsCount() { |
126 // Do a round trip to the renderer first to flush any in-flight IPCs to | 124 // Do a round trip to the renderer first to flush any in-flight IPCs to |
127 // create a to-be-blocked window. | 125 // create a to-be-blocked window. |
128 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 126 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
129 CHECK(content::ExecuteScript(tab, std::string())); | 127 CHECK(content::ExecuteScript(tab, std::string())); |
130 PopupBlockerTabHelper* popup_blocker_helper = | 128 PopupBlockerTabHelper* popup_blocker_helper = |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 814 |
817 wait_for_new_tab.Wait(); | 815 wait_for_new_tab.Wait(); |
818 | 816 |
819 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); | 817 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); |
820 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 818 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
821 // Check that we create the background tab. | 819 // Check that we create the background tab. |
822 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 820 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
823 } | 821 } |
824 | 822 |
825 } // namespace | 823 } // namespace |
OLD | NEW |