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

Side by Side Diff: chrome/browser/extensions/window_open_apitest.cc

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 (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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 ASSERT_TRUE(LoadExtension( 188 ASSERT_TRUE(LoadExtension(
189 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking") 189 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking")
190 .AppendASCII("extension"))); 190 .AppendASCII("extension")));
191 191
192 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 5, 3, 0)); 192 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 5, 3, 0));
193 } 193 }
194 194
195 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupBlockingHostedApp) { 195 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupBlockingHostedApp) {
196 host_resolver()->AddRule("*", "127.0.0.1"); 196 host_resolver()->AddRule("*", "127.0.0.1");
197 ASSERT_TRUE(test_server()->Start()); 197 ASSERT_TRUE(embedded_test_server()->Start());
198 198
199 ASSERT_TRUE(LoadExtension( 199 ASSERT_TRUE(LoadExtension(
200 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking") 200 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking")
201 .AppendASCII("hosted_app"))); 201 .AppendASCII("hosted_app")));
202 202
203 // The app being tested owns the domain a.com . The test URLs we navigate 203 // The app being tested owns the domain a.com . The test URLs we navigate
204 // to below must be within that domain, so that they fall within the app's 204 // to below must be within that domain, so that they fall within the app's
205 // web extent. 205 // web extent.
206 GURL::Replacements replace_host; 206 GURL::Replacements replace_host;
207 replace_host.SetHostStr("a.com"); 207 replace_host.SetHostStr("a.com");
208 208
209 const std::string popup_app_contents_path( 209 const std::string popup_app_contents_path(
210 "files/extensions/api_test/window_open/popup_blocking/hosted_app/"); 210 "/extensions/api_test/window_open/popup_blocking/hosted_app/");
211 211
212 GURL open_tab = 212 GURL open_tab = embedded_test_server()
213 test_server()->GetURL(popup_app_contents_path + "open_tab.html") 213 ->GetURL(popup_app_contents_path + "open_tab.html")
214 .ReplaceComponents(replace_host); 214 .ReplaceComponents(replace_host);
215 GURL open_popup = 215 GURL open_popup = embedded_test_server()
216 test_server()->GetURL(popup_app_contents_path + "open_popup.html") 216 ->GetURL(popup_app_contents_path + "open_popup.html")
217 .ReplaceComponents(replace_host); 217 .ReplaceComponents(replace_host);
218 218
219 browser()->OpenURL(OpenURLParams( 219 browser()->OpenURL(OpenURLParams(
220 open_tab, Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED, 220 open_tab, Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED,
221 false)); 221 false));
222 browser()->OpenURL(OpenURLParams( 222 browser()->OpenURL(OpenURLParams(
223 open_popup, Referrer(), NEW_FOREGROUND_TAB, 223 open_popup, Referrer(), NEW_FOREGROUND_TAB,
224 ui::PAGE_TRANSITION_TYPED, false)); 224 ui::PAGE_TRANSITION_TYPED, false));
225 225
226 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0)); 226 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0));
227 } 227 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 last_loaded_extension_id() + "/newtab.html"), 505 last_loaded_extension_id() + "/newtab.html"),
506 false, 506 false,
507 &newtab)); 507 &newtab));
508 508
509 // Extension API should succeed. 509 // Extension API should succeed.
510 bool result = false; 510 bool result = false;
511 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 511 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
512 &result)); 512 &result));
513 EXPECT_TRUE(result); 513 EXPECT_TRUE(result);
514 } 514 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_installer_test.cc ('k') | chrome/browser/external_extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698