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_enumerator.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 virtual void SetUp() OVERRIDE { | 48 virtual void SetUp() OVERRIDE { |
49 // Make sure there is no left overs. | 49 // Make sure there is no left overs. |
50 CleanupDumpDirectory(); | 50 CleanupDumpDirectory(); |
51 InProcessBrowserTest::SetUp(); | 51 InProcessBrowserTest::SetUp(); |
52 } | 52 } |
53 | 53 |
54 virtual void TearDown() OVERRIDE { | 54 virtual void TearDown() OVERRIDE { |
55 InProcessBrowserTest::TearDown(); | 55 InProcessBrowserTest::TearDown(); |
56 base::Delete(emf_path_, true); | 56 base::DeleteFile(emf_path_, true); |
57 } | 57 } |
58 | 58 |
59 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 59 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
60 command_line->AppendSwitchPath(switches::kDebugPrint, emf_path_); | 60 command_line->AppendSwitchPath(switches::kDebugPrint, emf_path_); |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
64 void PrintNowTab() { | 64 void PrintNowTab() { |
65 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, | 65 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, |
66 content::NotificationService::AllSources()); | 66 content::NotificationService::AllSources()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 found_emf = true; | 214 found_emf = true; |
215 emf_file = file.value(); | 215 emf_file = file.value(); |
216 continue; | 216 continue; |
217 } | 217 } |
218 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".prn") == 0) { | 218 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".prn") == 0) { |
219 EXPECT_FALSE(found_prn) << "Found a leftover .PRN file: \"" << | 219 EXPECT_FALSE(found_prn) << "Found a leftover .PRN file: \"" << |
220 prn_file << "\" and \"" << file.value() << | 220 prn_file << "\" and \"" << file.value() << |
221 "\" when looking for \"" << verification_name << "\""; | 221 "\" when looking for \"" << verification_name << "\""; |
222 prn_file = file.value(); | 222 prn_file = file.value(); |
223 found_prn = true; | 223 found_prn = true; |
224 base::Delete(file, false); | 224 base::DeleteFile(file, false); |
225 continue; | 225 continue; |
226 } | 226 } |
227 EXPECT_TRUE(false); | 227 EXPECT_TRUE(false); |
228 } | 228 } |
229 if (found_emf && found_prn) | 229 if (found_emf && found_prn) |
230 break; | 230 break; |
231 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 231 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
232 } | 232 } |
233 EXPECT_TRUE(found_emf) << ".PRN file is: " << prn_file; | 233 EXPECT_TRUE(found_emf) << ".PRN file is: " << prn_file; |
234 EXPECT_TRUE(found_prn) << ".EMF file is: " << emf_file; | 234 EXPECT_TRUE(found_prn) << ".EMF file is: " << emf_file; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 // 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. |
462 url = test_server()->GetURL("files/printing/test1.html"); | 462 url = test_server()->GetURL("files/printing/test1.html"); |
463 ui_test_utils::NavigateToURL(browser(), url); | 463 ui_test_utils::NavigateToURL(browser(), url); |
464 } | 464 } |
465 chrome::CloseWindow(browser()); | 465 chrome::CloseWindow(browser()); |
466 content::RunAllPendingInMessageLoop(); | 466 content::RunAllPendingInMessageLoop(); |
467 | 467 |
468 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 468 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
469 } | 469 } |
OLD | NEW |