OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "chrome/utility/cloud_print/bitmap_image.h" | 10 #include "chrome/utility/cloud_print/bitmap_image.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 for (int j = 400; j < 500; j++) { | 52 for (int j = 400; j < 500; j++) { |
53 int row_start = j * kRasterWidth; | 53 int row_start = j * kRasterWidth; |
54 if ((i/40) % 2 == 0) { | 54 if ((i/40) % 2 == 0) { |
55 bitmap_data[row_start + i] = 255 << 8; | 55 bitmap_data[row_start + i] = 255 << 8; |
56 } else { | 56 } else { |
57 bitmap_data[row_start + i] = 255 << 16; | 57 bitmap_data[row_start + i] = 255 << 16; |
58 } | 58 } |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 return bitmap_image.Pass(); | 62 return bitmap_image; |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 TEST(PwgRasterTest, CompareWithMaster) { | 67 TEST(PwgRasterTest, CompareWithMaster) { |
68 std::string output; | 68 std::string output; |
69 PwgEncoder encoder; | 69 PwgEncoder encoder; |
70 scoped_ptr<BitmapImage> image = MakeSampleBitmap(); | 70 scoped_ptr<BitmapImage> image = MakeSampleBitmap(); |
71 PwgHeaderInfo header_info; | 71 PwgHeaderInfo header_info; |
72 header_info.dpi = kRasterDPI; | 72 header_info.dpi = kRasterDPI; |
73 header_info.total_pages = 1; | 73 header_info.total_pages = 1; |
74 | 74 |
75 encoder.EncodeDocumentHeader(&output); | 75 encoder.EncodeDocumentHeader(&output); |
76 encoder.EncodePage(*image, header_info, &output); | 76 encoder.EncodePage(*image, header_info, &output); |
77 | 77 |
78 EXPECT_EQ(kPWGFileSha1, base::SHA1HashString(output)); | 78 EXPECT_EQ(kPWGFileSha1, base::SHA1HashString(output)); |
79 } | 79 } |
80 | 80 |
81 } // namespace cloud_print | 81 } // namespace cloud_print |
OLD | NEW |