| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/hash.h" | 10 #include "base/hash.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 }; | 82 }; |
| 83 for (size_t i = 0; i < arraysize(kFailingPdfs); ++i) { | 83 for (size_t i = 0; i < arraysize(kFailingPdfs); ++i) { |
| 84 if (kFailingPdfs[i] == pdf_file) | 84 if (kFailingPdfs[i] == pdf_file) |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Runs the extensions test at chrome/test/data/pdf/<filename> on the PDF file | 90 // Runs the extensions test at chrome/test/data/pdf/<filename> on the PDF file |
| 91 // at chrome/test/data/pdf/<pdf_filename>. | 91 // at chrome/test/data/pdf/<pdf_filename>. |
| 92 void RunTestsInFile(std::string filename, std::string pdf_filename) { | 92 void RunTestsInFile(const std::string& filename, |
| 93 const std::string& pdf_filename) { |
| 93 extensions::ResultCatcher catcher; | 94 extensions::ResultCatcher catcher; |
| 94 | 95 |
| 95 GURL url(embedded_test_server()->GetURL("/pdf/" + pdf_filename)); | 96 GURL url(embedded_test_server()->GetURL("/pdf/" + pdf_filename)); |
| 96 | 97 |
| 97 // It should be good enough to just navigate to the URL. But loading up the | 98 // It should be good enough to just navigate to the URL. But loading up the |
| 98 // BrowserPluginGuest seems to happen asynchronously as there was flakiness | 99 // BrowserPluginGuest seems to happen asynchronously as there was flakiness |
| 99 // being seen due to the BrowserPluginGuest not being available yet (see | 100 // being seen due to the BrowserPluginGuest not being available yet (see |
| 100 // crbug.com/498077). So instead use |LoadPdf| which ensures that the PDF is | 101 // crbug.com/498077). So instead use |LoadPdf| which ensures that the PDF is |
| 101 // loaded before continuing. | 102 // loaded before continuing. |
| 102 ASSERT_TRUE(LoadPdf(url)); | 103 ASSERT_TRUE(LoadPdf(url)); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 RunTestsInFile("title_test.js", "test-title.pdf"); | 430 RunTestsInFile("title_test.js", "test-title.pdf"); |
| 430 } | 431 } |
| 431 | 432 |
| 432 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, WhitespaceTitle) { | 433 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, WhitespaceTitle) { |
| 433 RunTestsInFile("whitespace_title_test.js", "test-whitespace-title.pdf"); | 434 RunTestsInFile("whitespace_title_test.js", "test-whitespace-title.pdf"); |
| 434 } | 435 } |
| 435 | 436 |
| 436 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, PageChange) { | 437 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, PageChange) { |
| 437 RunTestsInFile("page_change_test.js", "test-bookmarks.pdf"); | 438 RunTestsInFile("page_change_test.js", "test-bookmarks.pdf"); |
| 438 } | 439 } |
| OLD | NEW |