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

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

Issue 8038024: ui/gfx: Add ToString() function to Size class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | « no previous file | printing/page_setup_unittest.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) 2011 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_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/test/test_file_util.h" 9 #include "base/test/test_file_util.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 emf_content.SaveToPng(png); 79 emf_content.SaveToPng(png);
80 // Saving is always fine. 80 // Saving is always fine.
81 return 0; 81 return 0;
82 } else { 82 } else {
83 // File compare between test and result. 83 // File compare between test and result.
84 Image emf_content(emf); 84 Image emf_content(emf);
85 Image test_content(test_result); 85 Image test_content(test_result);
86 Image png_content(png); 86 Image png_content(png);
87 double diff_emf = emf_content.PercentageDifferent(test_content); 87 double diff_emf = emf_content.PercentageDifferent(test_content);
88 88
89 EXPECT_EQ(0., diff_emf) << verification_name << 89 EXPECT_EQ(0., diff_emf) << WideToUTF8(verification_name) <<
90 L" original size:" << emf_content.size() << 90 " original size:" << emf_content.size().ToString() <<
91 L" result size:" << test_content.size(); 91 " result size:" << test_content.size().ToString();
92 if (diff_emf) { 92 if (diff_emf) {
93 // Backup the result emf file. 93 // Backup the result emf file.
94 file_util::CopyFile(test_result, FilePath( 94 file_util::CopyFile(test_result, FilePath(
95 verification_file + L"_failed.emf")); 95 verification_file + L"_failed.emf"));
96 } 96 }
97 97
98 // This verification is only to know that the EMF rendering stays 98 // This verification is only to know that the EMF rendering stays
99 // immutable. 99 // immutable.
100 double diff_png = emf_content.PercentageDifferent(png_content); 100 double diff_png = emf_content.PercentageDifferent(png_content);
101 EXPECT_EQ(0., diff_png) << verification_name << 101 EXPECT_EQ(0., diff_png) << WideToUTF8(verification_name) <<
102 L" original size:" << emf_content.size() << 102 " original size:" << emf_content.size().ToString() <<
103 L" result size:" << test_content.size(); 103 " result size:" << test_content.size().ToString();
104 if (diff_png) { 104 if (diff_png) {
105 // Backup the rendered emf file to detect the rendering difference. 105 // Backup the rendered emf file to detect the rendering difference.
106 emf_content.SaveToPng(FilePath(verification_file + L"_rendering.png")); 106 emf_content.SaveToPng(FilePath(verification_file + L"_rendering.png"));
107 } 107 }
108 return std::max(diff_png, diff_emf); 108 return std::max(diff_png, diff_emf);
109 } 109 }
110 } 110 }
111 111
112 // Makes sure the directory exists and is empty. 112 // Makes sure the directory exists and is empty.
113 void CleanupDumpDirectory() { 113 void CleanupDumpDirectory() {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 // 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.
419 url = test_server.GetURL("files/printing/test1.html"); 419 url = test_server.GetURL("files/printing/test1.html");
420 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 420 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
421 tab_proxy->NavigateToURL(url)); 421 tab_proxy->NavigateToURL(url));
422 } 422 }
423 CloseBrowserAndServer(); 423 CloseBrowserAndServer();
424 424
425 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; 425 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe";
426 } 426 }
OLDNEW
« no previous file with comments | « no previous file | printing/page_setup_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698