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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
index a1b58b1afb44f94997dee35ee2116e6c95fb5de6..3b0f010ffb8522e177ec71cabfc88f2e901bc7ba 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -56,7 +56,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "google_apis/gaia/google_service_auth_error.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
@@ -394,9 +394,8 @@ class AutofillDialogControllerTest : public InProcessBrowserTest {
// Loads an html page on a provided server, the causes it to launch rAc.
// Returns whether rAc succesfully launched.
- bool RunTestPage(const net::SpawnedTestServer& server) {
- GURL url = server.GetURL(
- "files/request_autocomplete/test_page.html");
+ bool RunTestPage(const net::EmbeddedTestServer& server) {
+ GURL url = server.GetURL("/request_autocomplete/test_page.html");
ui_test_utils::NavigateToURL(browser(), url);
// Pass through the broken SSL interstitial, if any.
@@ -422,10 +421,9 @@ class AutofillDialogControllerTest : public InProcessBrowserTest {
return !!controller;
}
- void RunTestPageInIframe(const net::SpawnedTestServer& server) {
+ void RunTestPageInIframe(const net::EmbeddedTestServer& server) {
InitializeDOMMessageQueue();
- GURL iframe_url = server.GetURL(
- "files/request_autocomplete/test_page.html");
+ GURL iframe_url = server.GetURL("/request_autocomplete/test_page.html");
ui_test_utils::NavigateToURL(
browser(), GURL(std::string("data:text/html,") +
@@ -1082,10 +1080,8 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest,
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest,
DoesWorkOnHttpWithFlag) {
- net::SpawnedTestServer http_server(
- net::SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer http_server;
+ http_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(http_server.Start());
EXPECT_TRUE(RunTestPage(http_server));
}
@@ -1109,30 +1105,24 @@ class AutofillDialogControllerSecurityTest :
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
DoesntWorkOnHttp) {
- net::SpawnedTestServer http_server(
- net::SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer http_server;
+ http_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(http_server.Start());
EXPECT_FALSE(RunTestPage(http_server));
}
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
DoesWorkOnHttpWithFlags) {
- net::SpawnedTestServer https_server(
- net::SpawnedTestServer::TYPE_HTTPS,
- SSLOptions(SSLOptions::CERT_OK),
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ https_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(https_server.Start());
EXPECT_TRUE(RunTestPage(https_server));
}
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
DISABLED_DoesntWorkOnBrokenHttps) {
- net::SpawnedTestServer https_server(
- net::SpawnedTestServer::TYPE_HTTPS,
- SSLOptions(SSLOptions::CERT_EXPIRED),
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ https_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(https_server.Start());
EXPECT_FALSE(RunTestPage(https_server));
}
@@ -1318,10 +1308,8 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigate) {
// Tests that the rAc dialog hides when the main frame is navigated, even if
// it was invoked from a child frame.
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigateMainFrame) {
- net::SpawnedTestServer http_server(
- net::SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer http_server;
+ http_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(http_server.Start());
RunTestPageInIframe(http_server);
@@ -1333,10 +1321,8 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigateMainFrame) {
// Tests that the rAc dialog hides when the iframe it's in is navigated.
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigateIframe) {
- net::SpawnedTestServer http_server(
- net::SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ net::EmbeddedTestServer http_server;
+ http_server.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(http_server.Start());
RunTestPageInIframe(http_server);

Powered by Google App Engine
This is Rietveld 408576698