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" | |
8 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
12 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
13 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 15 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
17 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; | 413 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; |
415 return false; | 414 return false; |
416 } | 415 } |
417 return true; | 416 return true; |
418 } | 417 } |
419 | 418 |
420 // If no valid local revision file is located, the ref_img_revision_ is 0. | 419 // If no valid local revision file is located, the ref_img_revision_ is 0. |
421 void ObtainLocalRefImageRevision() { | 420 void ObtainLocalRefImageRevision() { |
422 base::FilePath filter; | 421 base::FilePath filter; |
423 filter = filter.AppendASCII(test_name_ + "_*.rev"); | 422 filter = filter.AppendASCII(test_name_ + "_*.rev"); |
424 base::FileEnumerator locator(ref_img_dir_, | 423 file_util::FileEnumerator locator(ref_img_dir_, |
425 false, // non recursive | 424 false, // non recursive |
426 base::FileEnumerator::FILES, | 425 file_util::FileEnumerator::FILES, |
427 filter.value()); | 426 filter.value()); |
428 int64 max_revision = 0; | 427 int64 max_revision = 0; |
429 std::vector<base::FilePath> outdated_revs; | 428 std::vector<base::FilePath> outdated_revs; |
430 for (base::FilePath full_path = locator.Next(); | 429 for (base::FilePath full_path = locator.Next(); |
431 !full_path.empty(); | 430 !full_path.empty(); |
432 full_path = locator.Next()) { | 431 full_path = locator.Next()) { |
433 std::string filename = | 432 std::string filename = |
434 full_path.BaseName().RemoveExtension().MaybeAsASCII(); | 433 full_path.BaseName().RemoveExtension().MaybeAsASCII(); |
435 std::string revision_string = | 434 std::string revision_string = |
436 filename.substr(test_name_.length() + 1); | 435 filename.substr(test_name_.length() + 1); |
437 int64 revision = 0; | 436 int64 revision = 0; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 {160, 100, 0, 0, 0} | 540 {160, 100, 0, 0, 0} |
542 }; | 541 }; |
543 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); | 542 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); |
544 | 543 |
545 gfx::Size container_size(400, 300); | 544 gfx::Size container_size(400, 300); |
546 base::FilePath url = | 545 base::FilePath url = |
547 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 546 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
548 RunPixelTest(container_size, url, ref_img_revision_update, | 547 RunPixelTest(container_size, url, ref_img_revision_update, |
549 ref_pixels, ref_pixel_count); | 548 ref_pixels, ref_pixel_count); |
550 } | 549 } |
OLD | NEW |