OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/simple_thread.h" | 7 #include "base/simple_thread.h" |
8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Looks for Cleartype override. | 73 // Looks for Cleartype override. |
74 if (file_util::PathExists( | 74 if (file_util::PathExists( |
75 FilePath::FromWStringHack(verification_file + L"_cleartype.png")) && | 75 FilePath::FromWStringHack(verification_file + L"_cleartype.png")) && |
76 IsClearTypeEnabled()) { | 76 IsClearTypeEnabled()) { |
77 png = FilePath(verification_file + L"_cleartype.png"); | 77 png = FilePath(verification_file + L"_cleartype.png"); |
78 } | 78 } |
79 | 79 |
80 if (GenerateFiles()) { | 80 if (GenerateFiles()) { |
81 // Copy the .emf and generate an .png. | 81 // Copy the .emf and generate an .png. |
82 file_util::CopyFile(test_result, emf); | 82 file_util::CopyFile(test_result, emf); |
83 Image emf_content(emf.value()); | 83 Image emf_content(emf); |
84 emf_content.SaveToPng(png); | 84 emf_content.SaveToPng(png); |
85 // Saving is always fine. | 85 // Saving is always fine. |
86 return 0; | 86 return 0; |
87 } else { | 87 } else { |
88 // File compare between test and result. | 88 // File compare between test and result. |
89 Image emf_content(emf.value()); | 89 Image emf_content(emf); |
90 Image test_content(test_result.value()); | 90 Image test_content(test_result); |
91 Image png_content(png.value()); | 91 Image png_content(png); |
92 double diff_emf = emf_content.PercentageDifferent(test_content); | 92 double diff_emf = emf_content.PercentageDifferent(test_content); |
93 | 93 |
94 EXPECT_EQ(0., diff_emf) << verification_name << | 94 EXPECT_EQ(0., diff_emf) << verification_name << |
95 L" original size:" << emf_content.size() << | 95 L" original size:" << emf_content.size() << |
96 L" result size:" << test_content.size(); | 96 L" result size:" << test_content.size(); |
97 if (diff_emf) { | 97 if (diff_emf) { |
98 // Backup the result emf file. | 98 // Backup the result emf file. |
99 file_util::CopyFile(test_result, FilePath( | 99 file_util::CopyFile(test_result, FilePath( |
100 verification_file + L"_failed.emf")); | 100 verification_file + L"_failed.emf")); |
101 } | 101 } |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 // Force a navigation elsewhere to verify that it's fine with it. | 430 // Force a navigation elsewhere to verify that it's fine with it. |
431 url = server->TestServerPage("files/printing/test1.html"); | 431 url = server->TestServerPage("files/printing/test1.html"); |
432 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 432 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
433 tab_proxy->NavigateToURL(url)); | 433 tab_proxy->NavigateToURL(url)); |
434 } | 434 } |
435 CloseBrowserAndServer(); | 435 CloseBrowserAndServer(); |
436 | 436 |
437 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 437 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
438 } | 438 } |
OLD | NEW |