| 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_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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 13 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 14 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 15 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/content_paths.h" | 15 #include "content/public/common/content_paths.h" |
| 17 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; | 391 LOG(ERROR) << "Decode PNG to a SkBitmap failed"; |
| 393 return false; | 392 return false; |
| 394 } | 393 } |
| 395 return true; | 394 return true; |
| 396 } | 395 } |
| 397 | 396 |
| 398 // 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. |
| 399 void ObtainLocalRefImageRevision() { | 398 void ObtainLocalRefImageRevision() { |
| 400 base::FilePath filter; | 399 base::FilePath filter; |
| 401 filter = filter.AppendASCII(test_name_ + "_*.rev"); | 400 filter = filter.AppendASCII(test_name_ + "_*.rev"); |
| 402 base::FileEnumerator locator(ref_img_dir_, | 401 file_util::FileEnumerator locator(ref_img_dir_, |
| 403 false, // non recursive | 402 false, // non recursive |
| 404 base::FileEnumerator::FILES, | 403 file_util::FileEnumerator::FILES, |
| 405 filter.value()); | 404 filter.value()); |
| 406 int64 max_revision = 0; | 405 int64 max_revision = 0; |
| 407 std::vector<base::FilePath> outdated_revs; | 406 std::vector<base::FilePath> outdated_revs; |
| 408 for (base::FilePath full_path = locator.Next(); | 407 for (base::FilePath full_path = locator.Next(); |
| 409 !full_path.empty(); | 408 !full_path.empty(); |
| 410 full_path = locator.Next()) { | 409 full_path = locator.Next()) { |
| 411 std::string filename = | 410 std::string filename = |
| 412 full_path.BaseName().RemoveExtension().MaybeAsASCII(); | 411 full_path.BaseName().RemoveExtension().MaybeAsASCII(); |
| 413 std::string revision_string = | 412 std::string revision_string = |
| 414 filename.substr(test_name_.length() + 1); | 413 filename.substr(test_name_.length() + 1); |
| 415 int64 revision = 0; | 414 int64 revision = 0; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 552 |
| 554 gfx::Size container_size(400, 300); | 553 gfx::Size container_size(400, 300); |
| 555 base::FilePath url = | 554 base::FilePath url = |
| 556 test_data_dir().AppendASCII("pixel_browser_plugin.html"); | 555 test_data_dir().AppendASCII("pixel_browser_plugin.html"); |
| 557 RunPixelTest(container_size, url, ref_img_revision_update, | 556 RunPixelTest(container_size, url, ref_img_revision_update, |
| 558 ref_pixels, ref_pixel_count); | 557 ref_pixels, ref_pixel_count); |
| 559 } | 558 } |
| 560 | 559 |
| 561 } // namespace content | 560 } // namespace content |
| 562 | 561 |
| OLD | NEW |