OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_enumerator.h" |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "base/process_util.h" | 11 #include "base/process_util.h" |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/test/test_file_util.h" | 13 #include "base/test/test_file_util.h" |
13 #include "base/threading/simple_thread.h" | 14 #include "base/threading/simple_thread.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/printing/print_job.h" | 16 #include "chrome/browser/printing/print_job.h" |
16 #include "chrome/browser/printing/print_view_manager.h" | 17 #include "chrome/browser/printing/print_view_manager.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 private: | 191 private: |
191 // Verifies that there is one .emf and one .prn file in the dump directory. | 192 // Verifies that there is one .emf and one .prn file in the dump directory. |
192 // Returns the path of the .emf file and deletes the .prn file. | 193 // Returns the path of the .emf file and deletes the .prn file. |
193 std::wstring ScanFiles(const std::wstring& verification_name) { | 194 std::wstring ScanFiles(const std::wstring& verification_name) { |
194 // Try to 10 seconds. | 195 // Try to 10 seconds. |
195 std::wstring emf_file; | 196 std::wstring emf_file; |
196 std::wstring prn_file; | 197 std::wstring prn_file; |
197 bool found_emf = false; | 198 bool found_emf = false; |
198 bool found_prn = false; | 199 bool found_prn = false; |
199 for (int i = 0; i < 100; ++i) { | 200 for (int i = 0; i < 100; ++i) { |
200 file_util::FileEnumerator enumerator(emf_path_, false, | 201 base::FileEnumerator enumerator(emf_path_, false, |
201 file_util::FileEnumerator::FILES); | 202 base::FileEnumerator::FILES); |
202 emf_file.clear(); | 203 emf_file.clear(); |
203 prn_file.clear(); | 204 prn_file.clear(); |
204 found_emf = false; | 205 found_emf = false; |
205 found_prn = false; | 206 found_prn = false; |
206 base::FilePath file; | 207 base::FilePath file; |
207 while (!(file = enumerator.Next()).empty()) { | 208 while (!(file = enumerator.Next()).empty()) { |
208 std::wstring ext = file.Extension(); | 209 std::wstring ext = file.Extension(); |
209 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) { | 210 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) { |
210 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" << | 211 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" << |
211 emf_file << "\" and \"" << file.value() << | 212 emf_file << "\" and \"" << file.value() << |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 460 |
460 // Force a navigation elsewhere to verify that it's fine with it. | 461 // Force a navigation elsewhere to verify that it's fine with it. |
461 url = test_server()->GetURL("files/printing/test1.html"); | 462 url = test_server()->GetURL("files/printing/test1.html"); |
462 ui_test_utils::NavigateToURL(browser(), url); | 463 ui_test_utils::NavigateToURL(browser(), url); |
463 } | 464 } |
464 chrome::CloseWindow(browser()); | 465 chrome::CloseWindow(browser()); |
465 content::RunAllPendingInMessageLoop(); | 466 content::RunAllPendingInMessageLoop(); |
466 | 467 |
467 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 468 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
468 } | 469 } |
OLD | NEW |