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