| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 rt = false; | 261 rt = false; |
| 262 } else { | 262 } else { |
| 263 LOG(INFO) << "Saved reference image to: " | 263 LOG(INFO) << "Saved reference image to: " |
| 264 << img_path.value(); | 264 << img_path.value(); |
| 265 } | 265 } |
| 266 if (rt) { | 266 if (rt) { |
| 267 if (!WriteREVFile(rev_path)) { | 267 if (!WriteREVFile(rev_path)) { |
| 268 LOG(ERROR) << "Can't save revision file to: " | 268 LOG(ERROR) << "Can't save revision file to: " |
| 269 << rev_path.value(); | 269 << rev_path.value(); |
| 270 rt = false; | 270 rt = false; |
| 271 file_util::Delete(img_path, false); | 271 base::Delete(img_path, false); |
| 272 } else { | 272 } else { |
| 273 LOG(INFO) << "Saved revision file to: " | 273 LOG(INFO) << "Saved revision file to: " |
| 274 << rev_path.value(); | 274 << rev_path.value(); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 if (ref_img_revision_ > 0) { | 277 if (ref_img_revision_ > 0) { |
| 278 LOG(ERROR) << "Can't read the local ref image: " | 278 LOG(ERROR) << "Can't read the local ref image: " |
| 279 << img_path.value() | 279 << img_path.value() |
| 280 << ", reset it."; | 280 << ", reset it."; |
| 281 rt = false; | 281 rt = false; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 continue; | 440 continue; |
| 441 if (revision < ref_img_revision_no_older_than_ || | 441 if (revision < ref_img_revision_no_older_than_ || |
| 442 revision < max_revision) { | 442 revision < max_revision) { |
| 443 outdated_revs.push_back(full_path); | 443 outdated_revs.push_back(full_path); |
| 444 continue; | 444 continue; |
| 445 } | 445 } |
| 446 max_revision = revision; | 446 max_revision = revision; |
| 447 } | 447 } |
| 448 ref_img_revision_ = max_revision; | 448 ref_img_revision_ = max_revision; |
| 449 for (size_t i = 0; i < outdated_revs.size(); ++i) | 449 for (size_t i = 0; i < outdated_revs.size(); ++i) |
| 450 file_util::Delete(outdated_revs[i], false); | 450 base::Delete(outdated_revs[i], false); |
| 451 } | 451 } |
| 452 | 452 |
| 453 DISALLOW_COPY_AND_ASSIGN(GpuPixelBrowserTest); | 453 DISALLOW_COPY_AND_ASSIGN(GpuPixelBrowserTest); |
| 454 }; | 454 }; |
| 455 | 455 |
| 456 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, WebGLGreenTriangle) { | 456 IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, WebGLGreenTriangle) { |
| 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 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 {160, 100, 0, 0, 0} | 541 {160, 100, 0, 0, 0} |
| 542 }; | 542 }; |
| 543 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 543 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
| 544 | 544 |
| 545 gfx::Size container_size(400, 300); | 545 gfx::Size container_size(400, 300); |
| 546 base::FilePath url = | 546 base::FilePath url = |
| 547 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 547 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
| 548 RunPixelTest(container_size, url, ref_img_revision_update, | 548 RunPixelTest(container_size, url, ref_img_revision_update, |
| 549 ref_pixels, ref_pixel_count); | 549 ref_pixels, ref_pixel_count); |
| 550 } | 550 } |
| OLD | NEW |