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

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase bug. Created 5 years, 1 month 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
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 class PopupBlockerBrowserTest : public InProcessBrowserTest { 139 class PopupBlockerBrowserTest : public InProcessBrowserTest {
140 public: 140 public:
141 PopupBlockerBrowserTest() {} 141 PopupBlockerBrowserTest() {}
142 ~PopupBlockerBrowserTest() override {} 142 ~PopupBlockerBrowserTest() override {}
143 143
144 void SetUpOnMainThread() override { 144 void SetUpOnMainThread() override {
145 InProcessBrowserTest::SetUpOnMainThread(); 145 InProcessBrowserTest::SetUpOnMainThread();
146 146
147 host_resolver()->AddRule("*", "127.0.0.1"); 147 host_resolver()->AddRule("*", "127.0.0.1");
148 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 148 ASSERT_TRUE(embedded_test_server()->Start());
149 } 149 }
150 150
151 int GetBlockedContentsCount() { 151 int GetBlockedContentsCount() {
152 // Do a round trip to the renderer first to flush any in-flight IPCs to 152 // Do a round trip to the renderer first to flush any in-flight IPCs to
153 // create a to-be-blocked window. 153 // create a to-be-blocked window.
154 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 154 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
155 CHECK(content::ExecuteScript(tab, std::string())); 155 CHECK(content::ExecuteScript(tab, std::string()));
156 PopupBlockerTabHelper* popup_blocker_helper = 156 PopupBlockerTabHelper* popup_blocker_helper =
157 PopupBlockerTabHelper::FromWebContents(tab); 157 PopupBlockerTabHelper::FromWebContents(tab);
158 return popup_blocker_helper->GetBlockedPopupsCount(); 158 return popup_blocker_helper->GetBlockedPopupsCount();
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 wait_for_new_tab.Wait(); 709 wait_for_new_tab.Wait();
710 710
711 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 711 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
712 browser()->host_desktop_type())); 712 browser()->host_desktop_type()));
713 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 713 ASSERT_EQ(2, browser()->tab_strip_model()->count());
714 // Check that we create the background tab. 714 // Check that we create the background tab.
715 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 715 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
716 } 716 }
717 717
718 } // namespace 718 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698