| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Command line flag for overriding the default location for putting generated | 45 // Command line flag for overriding the default location for putting generated |
| 46 // test images that do not match references. | 46 // test images that do not match references. |
| 47 const char kGeneratedDir[] = "generated-dir"; | 47 const char kGeneratedDir[] = "generated-dir"; |
| 48 // Command line flag for overriding the default location for reference images. | 48 // Command line flag for overriding the default location for reference images. |
| 49 const char kReferenceDir[] = "reference-dir"; | 49 const char kReferenceDir[] = "reference-dir"; |
| 50 // Command line flag for Chromium build revision. | 50 // Command line flag for Chromium build revision. |
| 51 const char kBuildRevision[] = "build-revision"; | 51 const char kBuildRevision[] = "build-revision"; |
| 52 | 52 |
| 53 // Reads and decodes a PNG image to a bitmap. Returns true on success. The PNG | 53 // Reads and decodes a PNG image to a bitmap. Returns true on success. The PNG |
| 54 // should have been encoded using |gfx::PNGCodec::Encode|. | 54 // should have been encoded using |gfx::PNGCodec::Encode|. |
| 55 bool ReadPNGFile(const FilePath& file_path, SkBitmap* bitmap) { | 55 bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) { |
| 56 DCHECK(bitmap); | 56 DCHECK(bitmap); |
| 57 FilePath abs_path(file_path); | 57 base::FilePath abs_path(file_path); |
| 58 if (!file_util::AbsolutePath(&abs_path)) | 58 if (!file_util::AbsolutePath(&abs_path)) |
| 59 return false; | 59 return false; |
| 60 | 60 |
| 61 std::string png_data; | 61 std::string png_data; |
| 62 return file_util::ReadFileToString(abs_path, &png_data) && | 62 return file_util::ReadFileToString(abs_path, &png_data) && |
| 63 gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), | 63 gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), |
| 64 png_data.length(), | 64 png_data.length(), |
| 65 bitmap); | 65 bitmap); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Encodes a bitmap into a PNG and write to disk. Returns true on success. The | 68 // Encodes a bitmap into a PNG and write to disk. Returns true on success. The |
| 69 // parent directory does not have to exist. | 69 // parent directory does not have to exist. |
| 70 bool WritePNGFile(const SkBitmap& bitmap, const FilePath& file_path) { | 70 bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path) { |
| 71 std::vector<unsigned char> png_data; | 71 std::vector<unsigned char> png_data; |
| 72 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data) && | 72 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data) && |
| 73 file_util::CreateDirectory(file_path.DirName())) { | 73 file_util::CreateDirectory(file_path.DirName())) { |
| 74 int bytes_written = file_util::WriteFile( | 74 int bytes_written = file_util::WriteFile( |
| 75 file_path, reinterpret_cast<char*>(&png_data[0]), png_data.size()); | 75 file_path, reinterpret_cast<char*>(&png_data[0]), png_data.size()); |
| 76 if (bytes_written == static_cast<int>(png_data.size())) | 76 if (bytes_written == static_cast<int>(png_data.size())) |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Write an empty file, whose name indicates the chrome revision when the ref | 82 // Write an empty file, whose name indicates the chrome revision when the ref |
| 83 // image was generated. | 83 // image was generated. |
| 84 bool WriteREVFile(const FilePath& file_path) { | 84 bool WriteREVFile(const base::FilePath& file_path) { |
| 85 if (file_util::CreateDirectory(file_path.DirName())) { | 85 if (file_util::CreateDirectory(file_path.DirName())) { |
| 86 char one_byte = 0; | 86 char one_byte = 0; |
| 87 int bytes_written = file_util::WriteFile(file_path, &one_byte, 1); | 87 int bytes_written = file_util::WriteFile(file_path, &one_byte, 1); |
| 88 if (bytes_written == 1) | 88 if (bytes_written == 1) |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace anonymous | 94 } // namespace anonymous |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 ReplaceFirstSubstringAfterOffset( | 149 ReplaceFirstSubstringAfterOffset( |
| 150 &test_name_, 0, test_status_prefixes[i], ""); | 150 &test_name_, 0, test_status_prefixes[i], ""); |
| 151 } | 151 } |
| 152 | 152 |
| 153 ui::DisableTestCompositor(); | 153 ui::DisableTestCompositor(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // If the existing ref image was saved from an revision older than the | 156 // If the existing ref image was saved from an revision older than the |
| 157 // ref_img_update_revision, refresh the ref image. | 157 // ref_img_update_revision, refresh the ref image. |
| 158 void RunPixelTest(const gfx::Size& tab_container_size, | 158 void RunPixelTest(const gfx::Size& tab_container_size, |
| 159 const FilePath& url, | 159 const base::FilePath& url, |
| 160 int64 ref_img_update_revision, | 160 int64 ref_img_update_revision, |
| 161 const ReferencePixel* ref_pixels, | 161 const ReferencePixel* ref_pixels, |
| 162 size_t ref_pixel_count) { | 162 size_t ref_pixel_count) { |
| 163 if (ref_img_option_ == kReferenceImageLocal) { | 163 if (ref_img_option_ == kReferenceImageLocal) { |
| 164 ref_img_revision_no_older_than_ = ref_img_update_revision; | 164 ref_img_revision_no_older_than_ = ref_img_update_revision; |
| 165 ObtainLocalRefImageRevision(); | 165 ObtainLocalRefImageRevision(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 DOMMessageQueue message_queue; | 168 DOMMessageQueue message_queue; |
| 169 NavigateToURL(shell(), net::FilePathToFileURL(url)); | 169 NavigateToURL(shell(), net::FilePathToFileURL(url)); |
| 170 | 170 |
| 171 std::string message; | 171 std::string message; |
| 172 // Wait for notification that page is loaded. | 172 // Wait for notification that page is loaded. |
| 173 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 173 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 174 EXPECT_STREQ("\"SUCCESS\"", message.c_str()) << message; | 174 EXPECT_STREQ("\"SUCCESS\"", message.c_str()) << message; |
| 175 | 175 |
| 176 SkBitmap bitmap; | 176 SkBitmap bitmap; |
| 177 ASSERT_TRUE(TabSnapShotToImage(&bitmap, tab_container_size)); | 177 ASSERT_TRUE(TabSnapShotToImage(&bitmap, tab_container_size)); |
| 178 bool same_pixels = true; | 178 bool same_pixels = true; |
| 179 if (ref_img_option_ == kReferenceImageNone && ref_pixels && ref_pixel_count) | 179 if (ref_img_option_ == kReferenceImageNone && ref_pixels && ref_pixel_count) |
| 180 same_pixels = ComparePixels(bitmap, ref_pixels, ref_pixel_count); | 180 same_pixels = ComparePixels(bitmap, ref_pixels, ref_pixel_count); |
| 181 else | 181 else |
| 182 same_pixels = CompareImages(bitmap); | 182 same_pixels = CompareImages(bitmap); |
| 183 EXPECT_TRUE(same_pixels); | 183 EXPECT_TRUE(same_pixels); |
| 184 } | 184 } |
| 185 | 185 |
| 186 const FilePath& test_data_dir() const { | 186 const base::FilePath& test_data_dir() const { |
| 187 return test_data_dir_; | 187 return test_data_dir_; |
| 188 } | 188 } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 FilePath test_data_dir_; | 191 base::FilePath test_data_dir_; |
| 192 FilePath generated_img_dir_; | 192 base::FilePath generated_img_dir_; |
| 193 FilePath ref_img_dir_; | 193 base::FilePath ref_img_dir_; |
| 194 int64 ref_img_revision_; | 194 int64 ref_img_revision_; |
| 195 std::string build_revision_; | 195 std::string build_revision_; |
| 196 // The name of the test, with any special prefixes dropped. | 196 // The name of the test, with any special prefixes dropped. |
| 197 std::string test_name_; | 197 std::string test_name_; |
| 198 | 198 |
| 199 // Any local ref image generated from older revision is ignored. | 199 // Any local ref image generated from older revision is ignored. |
| 200 int64 ref_img_revision_no_older_than_; | 200 int64 ref_img_revision_no_older_than_; |
| 201 | 201 |
| 202 // Whether use locally generated ref images, or checked in ref images, or | 202 // Whether use locally generated ref images, or checked in ref images, or |
| 203 // simply check a few key pixels. | 203 // simply check a few key pixels. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 214 // The number is the chromium revision that generated the image. | 214 // The number is the chromium revision that generated the image. |
| 215 // | 215 // |
| 216 // On failure or on ref image generation, the image and diff image will be | 216 // On failure or on ref image generation, the image and diff image will be |
| 217 // written to disk. The formats are: | 217 // written to disk. The formats are: |
| 218 // FAIL_<ref_image_name>, DIFF_<ref_image_name> | 218 // FAIL_<ref_image_name>, DIFF_<ref_image_name> |
| 219 // E.g., | 219 // E.g., |
| 220 // FAIL_WebGLTeapot_19762.png, DIFF_WebGLTeapot_19762.png | 220 // FAIL_WebGLTeapot_19762.png, DIFF_WebGLTeapot_19762.png |
| 221 bool CompareImages(const SkBitmap& gen_bmp) { | 221 bool CompareImages(const SkBitmap& gen_bmp) { |
| 222 SkBitmap ref_bmp_on_disk; | 222 SkBitmap ref_bmp_on_disk; |
| 223 | 223 |
| 224 FilePath img_path = ref_img_dir_.AppendASCII(test_name_ + ".png"); | 224 base::FilePath img_path = ref_img_dir_.AppendASCII(test_name_ + ".png"); |
| 225 bool found_ref_img = ReadPNGFile(img_path, &ref_bmp_on_disk); | 225 bool found_ref_img = ReadPNGFile(img_path, &ref_bmp_on_disk); |
| 226 | 226 |
| 227 if (!found_ref_img && ref_img_option_ == kReferenceImageCheckedIn) { | 227 if (!found_ref_img && ref_img_option_ == kReferenceImageCheckedIn) { |
| 228 LOG(ERROR) << "Couldn't find reference image: " | 228 LOG(ERROR) << "Couldn't find reference image: " |
| 229 << img_path.value(); | 229 << img_path.value(); |
| 230 // No image to compare to, exit early. | 230 // No image to compare to, exit early. |
| 231 return false; | 231 return false; |
| 232 } | 232 } |
| 233 | 233 |
| 234 const SkBitmap* ref_bmp; | 234 const SkBitmap* ref_bmp; |
| 235 bool save_gen = false; | 235 bool save_gen = false; |
| 236 bool save_diff = true; | 236 bool save_diff = true; |
| 237 bool rt = true; | 237 bool rt = true; |
| 238 | 238 |
| 239 if ((ref_img_revision_ <= 0 && ref_img_option_ == kReferenceImageLocal) || | 239 if ((ref_img_revision_ <= 0 && ref_img_option_ == kReferenceImageLocal) || |
| 240 !found_ref_img) { | 240 !found_ref_img) { |
| 241 FilePath rev_path = ref_img_dir_.AppendASCII( | 241 base::FilePath rev_path = ref_img_dir_.AppendASCII( |
| 242 test_name_ + "_" + build_revision_ + ".rev"); | 242 test_name_ + "_" + build_revision_ + ".rev"); |
| 243 if (!WritePNGFile(gen_bmp, img_path)) { | 243 if (!WritePNGFile(gen_bmp, img_path)) { |
| 244 LOG(ERROR) << "Can't save generated image to: " | 244 LOG(ERROR) << "Can't save generated image to: " |
| 245 << img_path.value() | 245 << img_path.value() |
| 246 << " as future reference."; | 246 << " as future reference."; |
| 247 rt = false; | 247 rt = false; |
| 248 } else { | 248 } else { |
| 249 LOG(INFO) << "Saved reference image to: " | 249 LOG(INFO) << "Saved reference image to: " |
| 250 << img_path.value(); | 250 << img_path.value(); |
| 251 } | 251 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (ref_img_option_ == kReferenceImageLocal) { | 314 if (ref_img_option_ == kReferenceImageLocal) { |
| 315 save_gen = true; | 315 save_gen = true; |
| 316 save_diff = true; | 316 save_diff = true; |
| 317 } | 317 } |
| 318 rt = false; | 318 rt = false; |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 std::string ref_img_filename = img_path.BaseName().MaybeAsASCII(); | 322 std::string ref_img_filename = img_path.BaseName().MaybeAsASCII(); |
| 323 if (save_gen) { | 323 if (save_gen) { |
| 324 FilePath img_fail_path = generated_img_dir_.AppendASCII( | 324 base::FilePath img_fail_path = generated_img_dir_.AppendASCII( |
| 325 "FAIL_" + ref_img_filename); | 325 "FAIL_" + ref_img_filename); |
| 326 if (!WritePNGFile(gen_bmp, img_fail_path)) { | 326 if (!WritePNGFile(gen_bmp, img_fail_path)) { |
| 327 LOG(ERROR) << "Can't save generated image to: " | 327 LOG(ERROR) << "Can't save generated image to: " |
| 328 << img_fail_path.value(); | 328 << img_fail_path.value(); |
| 329 } else { | 329 } else { |
| 330 LOG(INFO) << "Saved generated image to: " | 330 LOG(INFO) << "Saved generated image to: " |
| 331 << img_fail_path.value(); | 331 << img_fail_path.value(); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 if (save_diff) { | 334 if (save_diff) { |
| 335 FilePath img_diff_path = generated_img_dir_.AppendASCII( | 335 base::FilePath img_diff_path = generated_img_dir_.AppendASCII( |
| 336 "DIFF_" + ref_img_filename); | 336 "DIFF_" + ref_img_filename); |
| 337 if (!WritePNGFile(diff_bmp, img_diff_path)) { | 337 if (!WritePNGFile(diff_bmp, img_diff_path)) { |
| 338 LOG(ERROR) << "Can't save generated diff image to: " | 338 LOG(ERROR) << "Can't save generated diff image to: " |
| 339 << img_diff_path.value(); | 339 << img_diff_path.value(); |
| 340 } else { | 340 } else { |
| 341 LOG(INFO) << "Saved difference image to: " | 341 LOG(INFO) << "Saved difference image to: " |
| 342 << img_diff_path.value(); | 342 << img_diff_path.value(); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 return rt; | 345 return rt; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (!gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&*png.begin()), | 389 if (!gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&*png.begin()), |
| 390 png.size(), bitmap)) { | 390 png.size(), bitmap)) { |
| 391 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; | 391 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; |
| 392 return false; | 392 return false; |
| 393 } | 393 } |
| 394 return true; | 394 return true; |
| 395 } | 395 } |
| 396 | 396 |
| 397 // If no valid local revision file is located, the ref_img_revision_ is 0. | 397 // If no valid local revision file is located, the ref_img_revision_ is 0. |
| 398 void ObtainLocalRefImageRevision() { | 398 void ObtainLocalRefImageRevision() { |
| 399 FilePath filter; | 399 base::FilePath filter; |
| 400 filter = filter.AppendASCII(test_name_ + "_*.rev"); | 400 filter = filter.AppendASCII(test_name_ + "_*.rev"); |
| 401 file_util::FileEnumerator locator(ref_img_dir_, | 401 file_util::FileEnumerator locator(ref_img_dir_, |
| 402 false, // non recursive | 402 false, // non recursive |
| 403 file_util::FileEnumerator::FILES, | 403 file_util::FileEnumerator::FILES, |
| 404 filter.value()); | 404 filter.value()); |
| 405 int64 max_revision = 0; | 405 int64 max_revision = 0; |
| 406 std::vector<FilePath> outdated_revs; | 406 std::vector<base::FilePath> outdated_revs; |
| 407 for (FilePath full_path = locator.Next(); | 407 for (base::FilePath full_path = locator.Next(); |
| 408 !full_path.empty(); | 408 !full_path.empty(); |
| 409 full_path = locator.Next()) { | 409 full_path = locator.Next()) { |
| 410 std::string filename = | 410 std::string filename = |
| 411 full_path.BaseName().RemoveExtension().MaybeAsASCII(); | 411 full_path.BaseName().RemoveExtension().MaybeAsASCII(); |
| 412 std::string revision_string = | 412 std::string revision_string = |
| 413 filename.substr(test_name_.length() + 1); | 413 filename.substr(test_name_.length() + 1); |
| 414 int64 revision = 0; | 414 int64 revision = 0; |
| 415 bool converted = base::StringToInt64(revision_string, &revision); | 415 bool converted = base::StringToInt64(revision_string, &revision); |
| 416 if (!converted) | 416 if (!converted) |
| 417 continue; | 417 continue; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 440 {50, 100, 0, 0, 0}, | 440 {50, 100, 0, 0, 0}, |
| 441 {100, 100, 0, 255, 0}, | 441 {100, 100, 0, 255, 0}, |
| 442 {150, 100, 0, 0, 0}, | 442 {150, 100, 0, 0, 0}, |
| 443 {50, 150, 0, 255, 0}, | 443 {50, 150, 0, 255, 0}, |
| 444 {100, 150, 0, 255, 0}, | 444 {100, 150, 0, 255, 0}, |
| 445 {150, 150, 0, 255, 0} | 445 {150, 150, 0, 255, 0} |
| 446 }; | 446 }; |
| 447 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 447 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
| 448 | 448 |
| 449 gfx::Size container_size(400, 300); | 449 gfx::Size container_size(400, 300); |
| 450 FilePath url = | 450 base::FilePath url = |
| 451 test_data_dir().AppendASCII("pixel_webgl.html"); | 451 test_data_dir().AppendASCII("pixel_webgl.html"); |
| 452 RunPixelTest(container_size, url, ref_img_revision_update, | 452 RunPixelTest(container_size, url, ref_img_revision_update, |
| 453 ref_pixels, ref_pixel_count); | 453 ref_pixels, ref_pixel_count); |
| 454 } | 454 } |
| 455 | 455 |
| 456 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_CSS3DBlueBox) { | 456 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_CSS3DBlueBox) { |
| 457 // If test baseline needs to be updated after a given revision, update the | 457 // If test baseline needs to be updated after a given revision, update the |
| 458 // following number. If no revision requirement, then 0. | 458 // following number. If no revision requirement, then 0. |
| 459 const int64 ref_img_revision_update = 123489; | 459 const int64 ref_img_revision_update = 123489; |
| 460 | 460 |
| 461 const ReferencePixel ref_pixels[] = { | 461 const ReferencePixel ref_pixels[] = { |
| 462 // x, y, r, g, b | 462 // x, y, r, g, b |
| 463 {70, 50, 0, 0, 255}, | 463 {70, 50, 0, 0, 255}, |
| 464 {150, 50, 0, 0, 0}, | 464 {150, 50, 0, 0, 0}, |
| 465 {70, 90, 0, 0, 255}, | 465 {70, 90, 0, 0, 255}, |
| 466 {150, 90, 0, 0, 255}, | 466 {150, 90, 0, 0, 255}, |
| 467 {70, 125, 0, 0, 255}, | 467 {70, 125, 0, 0, 255}, |
| 468 {150, 125, 0, 0, 0} | 468 {150, 125, 0, 0, 0} |
| 469 }; | 469 }; |
| 470 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 470 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
| 471 | 471 |
| 472 gfx::Size container_size(400, 300); | 472 gfx::Size container_size(400, 300); |
| 473 FilePath url = | 473 base::FilePath url = |
| 474 test_data_dir().AppendASCII("pixel_css3d.html"); | 474 test_data_dir().AppendASCII("pixel_css3d.html"); |
| 475 RunPixelTest(container_size, url, ref_img_revision_update, | 475 RunPixelTest(container_size, url, ref_img_revision_update, |
| 476 ref_pixels, ref_pixel_count); | 476 ref_pixels, ref_pixel_count); |
| 477 } | 477 } |
| 478 | 478 |
| 479 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_Canvas2DRedBoxHD) { | 479 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MANUAL_Canvas2DRedBoxHD) { |
| 480 // If test baseline needs to be updated after a given revision, update the | 480 // If test baseline needs to be updated after a given revision, update the |
| 481 // following number. If no revision requirement, then 0. | 481 // following number. If no revision requirement, then 0. |
| 482 const int64 ref_img_revision_update = 123489; | 482 const int64 ref_img_revision_update = 123489; |
| 483 | 483 |
| 484 const ReferencePixel ref_pixels[] = { | 484 const ReferencePixel ref_pixels[] = { |
| 485 // x, y, r, g, b | 485 // x, y, r, g, b |
| 486 {40, 100, 0, 0, 0}, | 486 {40, 100, 0, 0, 0}, |
| 487 {60, 100, 127, 0, 0}, | 487 {60, 100, 127, 0, 0}, |
| 488 {140, 100, 127, 0, 0}, | 488 {140, 100, 127, 0, 0}, |
| 489 {160, 100, 0, 0, 0} | 489 {160, 100, 0, 0, 0} |
| 490 }; | 490 }; |
| 491 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 491 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
| 492 | 492 |
| 493 gfx::Size container_size(400, 300); | 493 gfx::Size container_size(400, 300); |
| 494 FilePath url = | 494 base::FilePath url = |
| 495 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 495 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
| 496 RunPixelTest(container_size, url, ref_img_revision_update, | 496 RunPixelTest(container_size, url, ref_img_revision_update, |
| 497 ref_pixels, ref_pixel_count); | 497 ref_pixels, ref_pixel_count); |
| 498 } | 498 } |
| 499 | 499 |
| 500 class GpuPixelTestCanvas2DSD : public GpuPixelBrowserTest { | 500 class GpuPixelTestCanvas2DSD : public GpuPixelBrowserTest { |
| 501 public: | 501 public: |
| 502 virtual void SetUpCommandLine(CommandLine* command_line) { | 502 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 503 GpuPixelBrowserTest::SetUpCommandLine(command_line); | 503 GpuPixelBrowserTest::SetUpCommandLine(command_line); |
| 504 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 504 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 505 } | 505 } |
| 506 }; | 506 }; |
| 507 | 507 |
| 508 IN_PROC_BROWSER_TEST_F(GpuPixelTestCanvas2DSD, MANUAL_Canvas2DRedBoxSD) { | 508 IN_PROC_BROWSER_TEST_F(GpuPixelTestCanvas2DSD, MANUAL_Canvas2DRedBoxSD) { |
| 509 // If test baseline needs to be updated after a given revision, update the | 509 // If test baseline needs to be updated after a given revision, update the |
| 510 // following number. If no revision requirement, then 0. | 510 // following number. If no revision requirement, then 0. |
| 511 const int64 ref_img_revision_update = 123489; | 511 const int64 ref_img_revision_update = 123489; |
| 512 | 512 |
| 513 const ReferencePixel ref_pixels[] = { | 513 const ReferencePixel ref_pixels[] = { |
| 514 // x, y, r, g, b | 514 // x, y, r, g, b |
| 515 {40, 100, 0, 0, 0}, | 515 {40, 100, 0, 0, 0}, |
| 516 {60, 100, 127, 0, 0}, | 516 {60, 100, 127, 0, 0}, |
| 517 {140, 100, 127, 0, 0}, | 517 {140, 100, 127, 0, 0}, |
| 518 {160, 100, 0, 0, 0} | 518 {160, 100, 0, 0, 0} |
| 519 }; | 519 }; |
| 520 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 520 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
| 521 | 521 |
| 522 gfx::Size container_size(400, 300); | 522 gfx::Size container_size(400, 300); |
| 523 FilePath url = | 523 base::FilePath url = |
| 524 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 524 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
| 525 RunPixelTest(container_size, url, ref_img_revision_update, | 525 RunPixelTest(container_size, url, ref_img_revision_update, |
| 526 ref_pixels, ref_pixel_count); | 526 ref_pixels, ref_pixel_count); |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace content | 529 } // namespace content |
| 530 | 530 |
| OLD | NEW |