Commit 32aabdf4 authored by phoglund@chromium.org's avatar phoglund@chromium.org

Will now DCHECK that test writers start the embedded server before using it.

One developer on my team was writing a browser test, but the test would just
hang. Turns out he forgot to start the embedded test server.

I think we can make the failure a lot clearer by adding a DCHECK which will
clearly point out the problem. I know that GetURL doesn't mean the test makes
a request to the server as such, but the returned URL will almost always be
fed into a NavigateToUrl request, so checking for this here will probably
be helpful in almost all cases.

R=phajdan.jr@chromium.org
BUG=301625

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226441 0039d316-1c4b-4281-b951-d872f2087c98
parent 391f36c0
...@@ -38,6 +38,7 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { ...@@ -38,6 +38,7 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) {
// If this crashes on Windows, use http://crbug.com/79331 // If this crashes on Windows, use http://crbug.com/79331
IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
// Disable cookies. // Disable cookies.
CookieSettings::Factory::GetForProfile(browser()->profile())-> CookieSettings::Factory::GetForProfile(browser()->profile())->
......
...@@ -174,6 +174,8 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) { ...@@ -174,6 +174,8 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) {
} }
IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) { IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) {
ASSERT_TRUE(StartEmbeddedTestServer());
const Extension* extension = LoadExtensionAndWait("filters"); const Extension* extension = LoadExtensionAndWait("filters");
ASSERT_TRUE(extension); ASSERT_TRUE(extension);
......
...@@ -196,6 +196,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection, ...@@ -196,6 +196,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection,
} }
GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const { GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const {
DCHECK(Started()) << "You must start the server first.";
DCHECK(StartsWithASCII(relative_url, "/", true /* case_sensitive */)) DCHECK(StartsWithASCII(relative_url, "/", true /* case_sensitive */))
<< relative_url; << relative_url;
return base_url_.Resolve(relative_url); return base_url_.Resolve(relative_url);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment