Chromium Code Reviews| Index: chrome/test/plugin/pdf_browsertest.cc |
| =================================================================== |
| --- chrome/test/plugin/pdf_browsertest.cc (revision 66587) |
| +++ chrome/test/plugin/pdf_browsertest.cc (working copy) |
| @@ -21,6 +21,7 @@ |
| #include "chrome/test/in_process_browser_test.h" |
| #include "chrome/test/ui_test_utils.h" |
| #include "gfx/codec/png_codec.h" |
| +#include "net/test/test_server.h" |
| extern base::hash_map<std::string, int> g_test_timeout_overrides; |
| @@ -52,22 +53,23 @@ |
| next_dummy_search_value_(0), |
| load_stop_notification_count_(0) { |
| EnableDOMAutomation(); |
| + |
| + pdf_test_server_.reset(new net::TestServer( |
| + net::TestServer::TYPE_HTTP, |
| + FilePath(FILE_PATH_LITERAL("pdf/test")))); |
|
chase
2010/11/20 02:41:31
Can GetPDFTestDir() be reused here too or does the
|
| } |
| protected: |
| + net::TestServer* pdf_test_server() { return pdf_test_server_.get(); } |
| + |
| int load_stop_notification_count() const { |
| return load_stop_notification_count_; |
| } |
| - virtual void SetUp() { |
| - FilePath pdf_path; |
| - PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); |
| - InProcessBrowserTest::SetUp(); |
| - } |
| - |
| FilePath GetPDFTestDir() { |
| - return FilePath(FilePath::kCurrentDirectory).AppendASCII("plugin"). |
| - AppendASCII("pdf"); |
| + return FilePath(FilePath::kCurrentDirectory).AppendASCII(".."). |
| + AppendASCII("..").AppendASCII("..").AppendASCII("pdf"). |
| + AppendASCII("test"); |
| } |
| void Load() { |
| @@ -204,6 +206,8 @@ |
| FilePath snapshot_filename_; |
| // How many times we've seen NotificationType::LOAD_STOP. |
| int load_stop_notification_count_; |
| + |
| + scoped_ptr<net::TestServer> pdf_test_server_; |
|
chase
2010/11/20 02:41:31
Would be good to have a comment here describing wh
|
| }; |
| #if defined(OS_MACOSX) |
| @@ -281,7 +285,7 @@ |
| // This also loads all documents that used to crash, to ensure we don't have |
| // regressions. |
| IN_PROC_BROWSER_TEST_F(PDFBrowserTest, Loading) { |
| - ASSERT_TRUE(test_server()->Start()); |
| + ASSERT_TRUE(pdf_test_server()->Start()); |
| NavigationController* controller = |
| &(browser()->GetSelectedTabContents()->controller()); |
| @@ -289,7 +293,7 @@ |
| registrar.Add(this, |
| NotificationType::LOAD_STOP, |
| Source<NavigationController>(controller)); |
| - std::string base_url = std::string("files/plugin/pdf/"); |
| + std::string base_url = std::string("files/"); |
| file_util::FileEnumerator file_enumerator( |
| ui_test_utils::GetTestFilePath(GetPDFTestDir(), FilePath()), |
| @@ -308,7 +312,7 @@ |
| LOG(WARNING) << "PDFBrowserTest.Loading: " << filename; |
| - GURL url = test_server()->GetURL(base_url + filename); |
| + GURL url = pdf_test_server()->GetURL(base_url + filename); |
| ui_test_utils::NavigateToURL(browser(), url); |
| while (true) { |