Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: chrome/test/gpu/gpu_pixel_browsertest.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_path.h" 8 #include "base/files/file_path.h"
8 #include "base/path_service.h" 9 #include "base/path_service.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 16 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
16 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; 414 LOG(ERROR) << "Decode PNG to a SkBitmap failed";
414 return false; 415 return false;
415 } 416 }
416 return true; 417 return true;
417 } 418 }
418 419
419 // If no valid local revision file is located, the ref_img_revision_ is 0. 420 // If no valid local revision file is located, the ref_img_revision_ is 0.
420 void ObtainLocalRefImageRevision() { 421 void ObtainLocalRefImageRevision() {
421 base::FilePath filter; 422 base::FilePath filter;
422 filter = filter.AppendASCII(test_name_ + "_*.rev"); 423 filter = filter.AppendASCII(test_name_ + "_*.rev");
423 file_util::FileEnumerator locator(ref_img_dir_, 424 base::FileEnumerator locator(ref_img_dir_,
424 false, // non recursive 425 false, // non recursive
425 file_util::FileEnumerator::FILES, 426 base::FileEnumerator::FILES,
426 filter.value()); 427 filter.value());
427 int64 max_revision = 0; 428 int64 max_revision = 0;
428 std::vector<base::FilePath> outdated_revs; 429 std::vector<base::FilePath> outdated_revs;
429 for (base::FilePath full_path = locator.Next(); 430 for (base::FilePath full_path = locator.Next();
430 !full_path.empty(); 431 !full_path.empty();
431 full_path = locator.Next()) { 432 full_path = locator.Next()) {
432 std::string filename = 433 std::string filename =
433 full_path.BaseName().RemoveExtension().MaybeAsASCII(); 434 full_path.BaseName().RemoveExtension().MaybeAsASCII();
434 std::string revision_string = 435 std::string revision_string =
435 filename.substr(test_name_.length() + 1); 436 filename.substr(test_name_.length() + 1);
436 int64 revision = 0; 437 int64 revision = 0;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 {160, 100, 0, 0, 0} 541 {160, 100, 0, 0, 0}
541 }; 542 };
542 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); 543 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel);
543 544
544 gfx::Size container_size(400, 300); 545 gfx::Size container_size(400, 300);
545 base::FilePath url = 546 base::FilePath url =
546 test_data_dir().AppendASCII("pixel_canvas2d.html"); 547 test_data_dir().AppendASCII("pixel_canvas2d.html");
547 RunPixelTest(container_size, url, ref_img_revision_update, 548 RunPixelTest(container_size, url, ref_img_revision_update,
548 ref_pixels, ref_pixel_count); 549 ref_pixels, ref_pixel_count);
549 } 550 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/util.cc ('k') | chrome/test/mini_installer_test/installer_path_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698