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

Side by Side Diff: chrome/test/reliability/automated_ui_tests.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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
« no previous file with comments | « chrome/test/perf/startup_test.cc ('k') | chrome/test/reliability/page_load_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <fstream> 5 #include <fstream>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/file_version_info.h" 12 #include "base/file_version_info.h"
13 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/i18n/time_formatting.h" 15 #include "base/i18n/time_formatting.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/rand_util.h" 18 #include "base/rand_util.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
22 #include "base/threading/platform_thread.h" 23 #include "base/threading/platform_thread.h"
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 } 765 }
765 766
766 base::FilePath AutomatedUITest::GetMostRecentCrashDump() { 767 base::FilePath AutomatedUITest::GetMostRecentCrashDump() {
767 base::FilePath crash_dump_path; 768 base::FilePath crash_dump_path;
768 base::FilePath most_recent_file_name; 769 base::FilePath most_recent_file_name;
769 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); 770 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path);
770 base::Time most_recent_file_time; 771 base::Time most_recent_file_time;
771 772
772 bool first_file = true; 773 bool first_file = true;
773 774
774 file_util::FileEnumerator enumerator(crash_dump_path, 775 base::FileEnumerator enumerator(crash_dump_path,
775 false, // not recursive 776 false, // not recursive
776 file_util::FileEnumerator::FILES); 777 base::FileEnumerator::FILES);
777 for (base::FilePath path = enumerator.Next(); !path.value().empty(); 778 for (base::FilePath path = enumerator.Next(); !path.value().empty();
778 path = enumerator.Next()) { 779 path = enumerator.Next()) {
779 base::PlatformFileInfo file_info; 780 base::PlatformFileInfo file_info;
780 file_util::GetFileInfo(path, &file_info); 781 file_util::GetFileInfo(path, &file_info);
781 if (first_file) { 782 if (first_file) {
782 most_recent_file_time = file_info.last_modified; 783 most_recent_file_time = file_info.last_modified;
783 most_recent_file_name = path.BaseName(); 784 most_recent_file_name = path.BaseName();
784 first_file = false; 785 first_file = false;
785 } else if (file_info.last_modified >= most_recent_file_time) { 786 } else if (file_info.last_modified >= most_recent_file_time) {
786 most_recent_file_time = file_info.last_modified; 787 most_recent_file_time = file_info.last_modified;
(...skipping 22 matching lines...) Expand all
809 } 810 }
810 } 811 }
811 812
812 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { 813 TEST_F(AutomatedUITest, TheOneAndOnlyTest) {
813 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 814 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
814 if (parsed_command_line.HasSwitch(kReproSwitch)) 815 if (parsed_command_line.HasSwitch(kReproSwitch))
815 RunReproduction(); 816 RunReproduction();
816 else 817 else
817 RunAutomatedUITest(); 818 RunAutomatedUITest();
818 } 819 }
OLDNEW
« no previous file with comments | « chrome/test/perf/startup_test.cc ('k') | chrome/test/reliability/page_load_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698