OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/layout_test_controller_host.h" | 5 #include "content/shell/layout_test_controller_host.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
9 #include "content/shell/shell_messages.h" | 9 #include "content/shell/shell_messages.h" |
10 #include "webkit/support/webkit_support_gfx.h" | 10 #include "webkit/support/webkit_support_gfx.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (actual_pixel_hash != expected_pixel_hash_) { | 132 if (actual_pixel_hash != expected_pixel_hash_) { |
133 std::vector<unsigned char> png; | 133 std::vector<unsigned char> png; |
134 | 134 |
135 // Only the expected PNGs for Mac have a valid alpha channel. | 135 // Only the expected PNGs for Mac have a valid alpha channel. |
136 #if defined(OS_MACOSX) | 136 #if defined(OS_MACOSX) |
137 bool discard_transparency = false; | 137 bool discard_transparency = false; |
138 #else | 138 #else |
139 bool discard_transparency = true; | 139 bool discard_transparency = true; |
140 #endif | 140 #endif |
141 | 141 |
142 webkit_support::EncodeBGRAPNGWithChecksum( | 142 if (webkit_support::EncodeBGRAPNGWithChecksum( |
143 reinterpret_cast<const unsigned char*>(image.getPixels()), | 143 reinterpret_cast<const unsigned char*>(image.getPixels()), |
144 image.width(), | 144 image.width(), |
145 image.height(), | 145 image.height(), |
146 static_cast<int>(image.rowBytes()), | 146 static_cast<int>(image.rowBytes()), |
147 discard_transparency, | 147 discard_transparency, |
148 actual_pixel_hash, | 148 actual_pixel_hash, |
149 &png); | 149 &png)) { |
150 | 150 printf("Content-Type: image/png\n"); |
151 printf("Content-Type: image/png\n"); | 151 printf("Content-Length: %u\n", static_cast<unsigned>(png.size())); |
152 printf("Content-Length: %u\n", static_cast<unsigned>(png.size())); | 152 fwrite(&png[0], 1, png.size(), stdout); |
153 fwrite(&png[0], 1, png.size(), stdout); | 153 } |
154 } | 154 } |
155 | 155 |
156 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 156 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
157 #endif | 157 #endif |
158 } | 158 } |
159 | 159 |
160 void LayoutTestControllerHost::OnNotifyDone() { | 160 void LayoutTestControllerHost::OnNotifyDone() { |
161 if (!wait_until_done_) | 161 if (!wait_until_done_) |
162 return; | 162 return; |
163 watchdog_.Cancel(); | 163 watchdog_.Cancel(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return; | 200 return; |
201 printf("FAIL: NOT IMPLEMENTED: %s.%s\n", | 201 printf("FAIL: NOT IMPLEMENTED: %s.%s\n", |
202 object_name.c_str(), property_name.c_str()); | 202 object_name.c_str(), property_name.c_str()); |
203 fprintf(stderr, "FAIL: NOT IMPLEMENTED: %s.%s\n", | 203 fprintf(stderr, "FAIL: NOT IMPLEMENTED: %s.%s\n", |
204 object_name.c_str(), property_name.c_str()); | 204 object_name.c_str(), property_name.c_str()); |
205 watchdog_.Cancel(); | 205 watchdog_.Cancel(); |
206 CaptureDump(); | 206 CaptureDump(); |
207 } | 207 } |
208 | 208 |
209 } // namespace content | 209 } // namespace content |
OLD | NEW |