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