Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/bitmap_header.h" | 7 #include "base/gfx/bitmap_header.h" |
| 7 #include "base/gfx/platform_device_win.h" | 8 #include "base/gfx/platform_device_win.h" |
| 8 #include "base/gfx/png_decoder.h" | 9 #include "base/gfx/png_decoder.h" |
| 9 #include "base/gfx/png_encoder.h" | 10 #include "base/gfx/png_encoder.h" |
| 10 #include "base/time.h" | 11 #include "base/time.h" |
| 11 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/common/gfx/emf.h" | 14 #include "chrome/common/gfx/emf.h" |
| 14 #include "chrome/test/automation/browser_proxy.h" | 15 #include "chrome/test/automation/browser_proxy.h" |
| 15 #include "chrome/test/automation/tab_proxy.h" | 16 #include "chrome/test/automation/tab_proxy.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 ASSERT_FALSE(data_.empty()); | 52 ASSERT_FALSE(data_.empty()); |
| 52 std::vector<unsigned char> compressed; | 53 std::vector<unsigned char> compressed; |
| 53 ASSERT_TRUE(PNGEncoder::Encode(&*data_.begin(), | 54 ASSERT_TRUE(PNGEncoder::Encode(&*data_.begin(), |
| 54 PNGEncoder::FORMAT_BGRA, | 55 PNGEncoder::FORMAT_BGRA, |
| 55 size_.width(), | 56 size_.width(), |
| 56 size_.height(), | 57 size_.height(), |
| 57 row_length_, | 58 row_length_, |
| 58 true, | 59 true, |
| 59 &compressed)); | 60 &compressed)); |
| 60 ASSERT_TRUE(compressed.size()); | 61 ASSERT_TRUE(compressed.size()); |
| 61 FILE* f; | 62 ASSERT_EQ(compressed.size(), file_util::WriteFile(filename, |
| 62 ASSERT_EQ(_wfopen_s(&f, filename.c_str(), L"wbS"), 0); | 63 compressed.data(), |
|
Mark Mentovai
2008/10/01 17:40:55
std::vector<> has no data(), I think you want &*co
| |
| 63 ASSERT_EQ(fwrite(&*compressed.begin(), 1, compressed.size(), f), | 64 compressed.size())); |
| 64 compressed.size()); | |
| 65 fclose(f); | |
| 66 } | 65 } |
| 67 | 66 |
| 68 double PercentageDifferent(const Image& rhs) const { | 67 double PercentageDifferent(const Image& rhs) const { |
| 69 if (size_.width() == 0 || size_.height() == 0 || | 68 if (size_.width() == 0 || size_.height() == 0 || |
| 70 rhs.size_.width() == 0 || rhs.size_.height() == 0) | 69 rhs.size_.width() == 0 || rhs.size_.height() == 0) |
| 71 return 100.; | 70 return 100.; |
| 72 | 71 |
| 73 int width = std::min(size_.width(), rhs.size_.width()); | 72 int width = std::min(size_.width(), rhs.size_.width()); |
| 74 int height = std::min(size_.height(), rhs.size_.height()); | 73 int height = std::min(size_.height(), rhs.size_.height()); |
| 75 // Compute pixels different in the overlap | 74 // Compute pixels different in the overlap |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 url = server.TestServerPage("files/printing/test1.html"); | 616 url = server.TestServerPage("files/printing/test1.html"); |
| 618 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 617 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| 619 tab_proxy->NavigateToURL(url)); | 618 tab_proxy->NavigateToURL(url)); |
| 620 } | 619 } |
| 621 CloseBrowserAndServer(); | 620 CloseBrowserAndServer(); |
| 622 | 621 |
| 623 EXPECT_EQ(0., CompareWithResult(L"iframe")) | 622 EXPECT_EQ(0., CompareWithResult(L"iframe")) |
| 624 << L"iframe"; | 623 << L"iframe"; |
| 625 } | 624 } |
| 626 | 625 |
| OLD | NEW |