Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Side by Side Diff: chrome/browser/printing/printing_layout_browsertest.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 private: 189 private:
189 // Verifies that there is one .emf and one .prn file in the dump directory. 190 // Verifies that there is one .emf and one .prn file in the dump directory.
190 // Returns the path of the .emf file and deletes the .prn file. 191 // Returns the path of the .emf file and deletes the .prn file.
191 std::wstring ScanFiles(const std::wstring& verification_name) { 192 std::wstring ScanFiles(const std::wstring& verification_name) {
192 // Try to 10 seconds. 193 // Try to 10 seconds.
193 std::wstring emf_file; 194 std::wstring emf_file;
194 std::wstring prn_file; 195 std::wstring prn_file;
195 bool found_emf = false; 196 bool found_emf = false;
196 bool found_prn = false; 197 bool found_prn = false;
197 for (int i = 0; i < 100; ++i) { 198 for (int i = 0; i < 100; ++i) {
198 file_util::FileEnumerator enumerator(emf_path_, false, 199 base::FileEnumerator enumerator(emf_path_, false,
199 file_util::FileEnumerator::FILES); 200 base::FileEnumerator::FILES);
200 emf_file.clear(); 201 emf_file.clear();
201 prn_file.clear(); 202 prn_file.clear();
202 found_emf = false; 203 found_emf = false;
203 found_prn = false; 204 found_prn = false;
204 base::FilePath file; 205 base::FilePath file;
205 while (!(file = enumerator.Next()).empty()) { 206 while (!(file = enumerator.Next()).empty()) {
206 std::wstring ext = file.Extension(); 207 std::wstring ext = file.Extension();
207 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) { 208 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) {
208 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" << 209 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" <<
209 emf_file << "\" and \"" << file.value() << 210 emf_file << "\" and \"" << file.value() <<
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 458
458 // Force a navigation elsewhere to verify that it's fine with it. 459 // Force a navigation elsewhere to verify that it's fine with it.
459 url = test_server()->GetURL("files/printing/test1.html"); 460 url = test_server()->GetURL("files/printing/test1.html");
460 ui_test_utils::NavigateToURL(browser(), url); 461 ui_test_utils::NavigateToURL(browser(), url);
461 } 462 }
462 chrome::CloseWindow(browser()); 463 chrome::CloseWindow(browser());
463 content::RunAllPendingInMessageLoop(); 464 content::RunAllPendingInMessageLoop();
464 465
465 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; 466 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe";
466 } 467 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698