From 95409e1020037b0bbfbce17f861d3de090d10186 Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Tue, 17 Aug 2010 20:07:11 +0000 Subject: Test server cleanup patch of death: - reduce the number of different classes - clean up the internal code - modify the interface to expose less internal details (this will allow more flexibility with port numbers) TEST=many BUG=49680 Review URL: http://codereview.chromium.org/3080029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56405 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/printing/printing_layout_uitest.cc | 35 +++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'chrome/browser/printing') diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc index 1d08d42..a87e2397 100644 --- a/chrome/browser/printing/printing_layout_uitest.cc +++ b/chrome/browser/printing/printing_layout_uitest.cc @@ -22,7 +22,7 @@ namespace { using printing::Image; const char kGenerateSwitch[] = "print-layout-generate"; -const wchar_t kDocRoot[] = L"chrome/test/data"; +const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); class PrintingLayoutTest : public PrintingTest { public: @@ -289,11 +289,10 @@ TEST_F(PrintingLayoutTextTest, FAILS_Complex) { "close_printdlg_thread"); // Print a document, check its output. - scoped_refptr server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(NULL != server.get()); + net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); + ASSERT_TRUE(test_server.Start()); - NavigateToURL(server->TestServerPage("files/printing/test1.html")); + NavigateToURL(test_server.GetURL("files/printing/test1.html")); close_printdlg_thread.Start(); PrintNowTab(); close_printdlg_thread.Join(); @@ -321,9 +320,9 @@ TEST_F(PrintingLayoutTestHidden, DISABLED_ManyTimes) { if (IsTestCaseDisabled()) return; - scoped_refptr server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(NULL != server.get()); + net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); + ASSERT_TRUE(test_server.Start()); + DismissTheWindow dismisser(base::GetProcId(process())); ASSERT_GT(arraysize(kTestPool), 0u); @@ -331,7 +330,7 @@ TEST_F(PrintingLayoutTestHidden, DISABLED_ManyTimes) { if (i) CleanupDumpDirectory(); const TestPool& test = kTestPool[i % arraysize(kTestPool)]; - NavigateToURL(server->TestServerPage(test.source)); + NavigateToURL(test_server.GetURL(test.source)); base::DelegateSimpleThread close_printdlg_thread1(&dismisser, "close_printdlg_thread"); EXPECT_EQ(NULL, FindDialogWindow(dismisser.owner_process())); @@ -372,15 +371,14 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) { if (IsTestCaseDisabled()) return; - scoped_refptr server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(NULL != server.get()); + net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); + ASSERT_TRUE(test_server.Start()); { scoped_refptr tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); bool is_timeout = true; - GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm"); + GURL url = test_server.GetURL("files/printing/popup_delayed_print.htm"); EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url)); @@ -391,7 +389,7 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) { close_printdlg_thread.Join(); // Force a navigation elsewhere to verify that it's fine with it. - url = server->TestServerPage("files/printing/test1.html"); + url = test_server.GetURL("files/printing/test1.html"); EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url)); } @@ -407,14 +405,13 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) { if (IsTestCaseDisabled()) return; - scoped_refptr server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(NULL != server.get()); + net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); + ASSERT_TRUE(test_server.Start()); { scoped_refptr tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - GURL url = server->TestServerPage("files/printing/iframe.htm"); + GURL url = test_server.GetURL("files/printing/iframe.htm"); EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url)); @@ -425,7 +422,7 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) { close_printdlg_thread.Join(); // Force a navigation elsewhere to verify that it's fine with it. - url = server->TestServerPage("files/printing/test1.html"); + url = test_server.GetURL("files/printing/test1.html"); EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url)); } -- cgit v1.1