| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" |
| 6 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/string_util.h" |
| 7 #include "base/test/test_file_util.h" | 9 #include "base/test/test_file_util.h" |
| 8 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
| 11 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/test/automation/tab_proxy.h" | 12 #include "chrome/test/automation/tab_proxy.h" |
| 10 #include "chrome/test/ui/ui_test.h" | 13 #include "chrome/test/ui/ui_test.h" |
| 11 #include "net/test/test_server.h" | 14 #include "net/test/test_server.h" |
| 12 #include "printing/image.h" | 15 #include "printing/image.h" |
| 13 #include "printing/printing_test.h" | 16 #include "printing/printing_test.h" |
| 14 | 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 using printing::Image; | 20 using printing::Image; |
| 18 | 21 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool found_prn = false; | 138 bool found_prn = false; |
| 136 for (int i = 0; i < 100; ++i) { | 139 for (int i = 0; i < 100; ++i) { |
| 137 file_util::FileEnumerator enumerator(emf_path(), false, | 140 file_util::FileEnumerator enumerator(emf_path(), false, |
| 138 file_util::FileEnumerator::FILES); | 141 file_util::FileEnumerator::FILES); |
| 139 emf_file.clear(); | 142 emf_file.clear(); |
| 140 prn_file.clear(); | 143 prn_file.clear(); |
| 141 found_emf = false; | 144 found_emf = false; |
| 142 found_prn = false; | 145 found_prn = false; |
| 143 std::wstring file; | 146 std::wstring file; |
| 144 while (!(file = enumerator.Next().ToWStringHack()).empty()) { | 147 while (!(file = enumerator.Next().ToWStringHack()).empty()) { |
| 145 std::wstring ext = file_util::GetFileExtensionFromPath(file); | 148 std::wstring ext = FilePath(file).Extension(); |
| 146 if (!_wcsicmp(ext.c_str(), L"emf")) { | 149 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) { |
| 147 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" << | 150 EXPECT_FALSE(found_emf) << "Found a leftover .EMF file: \"" << |
| 148 emf_file << "\" and \"" << file << "\" when looking for \"" << | 151 emf_file << "\" and \"" << file << "\" when looking for \"" << |
| 149 verification_name << "\""; | 152 verification_name << "\""; |
| 150 found_emf = true; | 153 found_emf = true; |
| 151 emf_file = file; | 154 emf_file = file; |
| 152 continue; | 155 continue; |
| 153 } | 156 } |
| 154 if (!_wcsicmp(ext.c_str(), L"prn")) { | 157 if (base::strcasecmp(WideToUTF8(ext).c_str(), ".prn") == 0) { |
| 155 EXPECT_FALSE(found_prn) << "Found a leftover .PRN file: \"" << | 158 EXPECT_FALSE(found_prn) << "Found a leftover .PRN file: \"" << |
| 156 prn_file << "\" and \"" << file << "\" when looking for \"" << | 159 prn_file << "\" and \"" << file << "\" when looking for \"" << |
| 157 verification_name << "\""; | 160 verification_name << "\""; |
| 158 prn_file = file; | 161 prn_file = file; |
| 159 found_prn = true; | 162 found_prn = true; |
| 160 file_util::Delete(file, false); | 163 file_util::Delete(file, false); |
| 161 continue; | 164 continue; |
| 162 } | 165 } |
| 163 EXPECT_TRUE(false); | 166 EXPECT_TRUE(false); |
| 164 } | 167 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 417 |
| 415 // Force a navigation elsewhere to verify that it's fine with it. | 418 // Force a navigation elsewhere to verify that it's fine with it. |
| 416 url = test_server.GetURL("files/printing/test1.html"); | 419 url = test_server.GetURL("files/printing/test1.html"); |
| 417 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 420 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| 418 tab_proxy->NavigateToURL(url)); | 421 tab_proxy->NavigateToURL(url)); |
| 419 } | 422 } |
| 420 CloseBrowserAndServer(); | 423 CloseBrowserAndServer(); |
| 421 | 424 |
| 422 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 425 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
| 423 } | 426 } |
| OLD | NEW |