Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
net: remove InitializeAndWaitUntilReady() from EmbeddedTestServer
Browse files Browse the repository at this point in the history
Right now it is just calling Start(), so as the TODO say, this patch
removes it and update the callsites to call Start() instead.

This patch was generated on Linux by the following command line:

$ g grep -l InitializeAndWaitUntilReady content/ chrome/ | xargs perl -pi -e 's/InitializeAndWaitUntilReady/Start/g'

BUG=None
R=eroman@chromium.org,svaldez@chromium.org
TBR=jochen@chromium.org

Review URL: https://codereview.chromium.org/1482783003

Cr-Commit-Position: refs/heads/master@{#362232}
  • Loading branch information
tfarina authored and Commit bot committed Nov 30, 2015
1 parent 46470b4 commit 8dfd114
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DistillablePageUtilsBrowserTestOption : public InProcessBrowserTest {

void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());
web_contents_ =
browser()->tab_strip_model()->GetActiveWebContents();
setDelegate(web_contents_, holder_.GetDelegate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PrivetV3ContextGetterTest : public testing::Test,

void CreateServer(EmbeddedTestServer::Type type) {
server_.reset(new EmbeddedTestServer(type));
ASSERT_TRUE(server_->InitializeAndWaitUntilReady());
ASSERT_TRUE(server_->Start());

base::FilePath test_data_dir;
ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/extensions/extension_bindings_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ModuleSystem) {
}

IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoExportOverriding) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

// We need to create runtime bindings in the web page. An extension that's
// externally connectable will do that for us.
Expand All @@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoExportOverriding) {
}

IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoGinDefineOverriding) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

// We need to create runtime bindings in the web page. An extension that's
// externally connectable will do that for us.
Expand All @@ -165,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoGinDefineOverriding) {
}

IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, HandlerFunctionTypeChecking) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());
ui_test_utils::NavigateToURL(
browser(),
embedded_test_server()->GetURL(
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/local_discovery/privet_http_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ class PrivetHttpWithServerTest : public ::testing::Test,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));

server_.reset(new EmbeddedTestServer(EmbeddedTestServer::TYPE_HTTP));
ASSERT_TRUE(server_->InitializeAndWaitUntilReady());
ASSERT_TRUE(server_->Start());

base::FilePath test_data_dir;
ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/notifications/notification_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) {
IN_PROC_BROWSER_TEST_F(NotificationsTest, NotificationBlockerTest) {
ToggledNotificationBlocker blocker;

ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

// Creates a simple notification.
AllowAllOrigins();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ scoped_ptr<net::test_server::HttpResponse> SendResponse(
IN_PROC_BROWSER_TEST_F(TemplateURLScraperTest, ScrapeWithOnSubmit) {
host_resolver()->AddRule("*.foo.com", "localhost");
embedded_test_server()->RegisterRequestHandler(base::Bind(&SendResponse));
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

TemplateURLService* template_urls =
TemplateURLServiceFactory::GetInstance()->GetForProfile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CrossSitePauseInBeforeUnload) {

IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, InspectDuringFrameSwap) {
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());
content::SetupCrossSiteRedirector(embedded_test_server());

GURL test_url1 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class LoFiResourceDispatcherHostBrowserTest : public ContentBrowserTest {
void SetUpOnMainThread() override {
ContentBrowserTest::SetUpOnMainThread();

ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

delegate_.reset(new LoFiModeResourceDispatcherHostDelegate(
embedded_test_server()->GetURL("/page_with_iframe.html"),
Expand Down
2 changes: 1 addition & 1 deletion content/browser/wake_lock/wake_lock_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class WakeLockTest : public ContentBrowserTest {

void SetUpOnMainThread() override {
host_resolver()->AddRule("*", "127.0.0.1");
EXPECT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
EXPECT_TRUE(embedded_test_server()->Start());
// To prevent occlusion events from changing page visibility.
GetWebContents()->IncrementCapturerCount(gfx::Size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ class MockPageScaleObserver : public WebContentsObserver {
// When the page scale factor is set in the renderer it should send
// a notification to the browser so that WebContentsObservers are notified.
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ChangePageScale) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));

MockPageScaleObserver observer(shell());
Expand Down
2 changes: 1 addition & 1 deletion content/test/webrtc_content_browsertest_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult(

void WebRtcContentBrowserTest::MakeTypicalCall(const std::string& javascript,
const std::string& html_file) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(embedded_test_server()->Start());

GURL url(embedded_test_server()->GetURL(html_file));
NavigateToURL(shell(), url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ public void serveFilesFromDirectory(String directoryPath) {
nativeServeFilesFromDirectory(mNativeEmbeddedTestServer, directoryPath);
}

// TODO(svaldez): Remove once all consumers have switched to start().
/** Wrapper for start()
*
* start() should be used instead of this.
*
* @return Whether the server was successfully initialized.
*/
public boolean initializeAndWaitUntilReady() {
return start();
}

/** Starts the server.
*
* Note that this should be called after handlers are set up, including any relevant calls
Expand Down
4 changes: 0 additions & 4 deletions net/test/embedded_test_server/embedded_test_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ bool EmbeddedTestServer::Start() {
return true;
}

bool EmbeddedTestServer::InitializeAndWaitUntilReady() {
return Start();
}

bool EmbeddedTestServer::InitializeAndListen() {
DCHECK(!Started());

Expand Down
4 changes: 0 additions & 4 deletions net/test/embedded_test_server/embedded_test_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ class EmbeddedTestServer {
// Returns whether a listening socket has been successfully created.
bool Start();

// Deprecated method that calls Start().
// TODO(svaldez): Remove and replace with Start().
bool InitializeAndWaitUntilReady() WARN_UNUSED_RESULT;

// Starts listening for incoming connections but will not yet accept them.
// Returns whether a listening socket has been succesfully created.
bool InitializeAndListen() WARN_UNUSED_RESULT;
Expand Down

0 comments on commit 8dfd114

Please sign in to comment.