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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 RunTestsInFile("toolbar_manager_test.js", "test.pdf"); | 422 RunTestsInFile("toolbar_manager_test.js", "test.pdf"); |
422 } | 423 } |
423 | 424 |
424 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, Title) { | 425 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, Title) { |
425 RunTestsInFile("title_test.js", "test-title.pdf"); | 426 RunTestsInFile("title_test.js", "test-title.pdf"); |
426 } | 427 } |
427 | 428 |
428 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, WhitespaceTitle) { | 429 IN_PROC_BROWSER_TEST_F(MaterialPDFExtensionTest, WhitespaceTitle) { |
429 RunTestsInFile("whitespace_title_test.js", "test-whitespace-title.pdf"); | 430 RunTestsInFile("whitespace_title_test.js", "test-whitespace-title.pdf"); |
430 } | 431 } |
OLD | NEW |