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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); | 151 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); |
152 }; | 152 }; |
153 | 153 |
154 const char kSnapshotBaseName[] = "ChromiumSnapshot"; | 154 const char kSnapshotBaseName[] = "ChromiumSnapshot"; |
155 const char kSnapshotExtension[] = ".png"; | 155 const char kSnapshotExtension[] = ".png"; |
156 | 156 |
157 base::FilePath GetSnapshotFileName(const base::FilePath& snapshot_directory) { | 157 base::FilePath GetSnapshotFileName(const base::FilePath& snapshot_directory) { |
158 base::Time::Exploded the_time; | 158 base::Time::Exploded the_time; |
159 | 159 |
160 base::Time::Now().LocalExplode(&the_time); | 160 base::Time::Now().LocalExplode(&the_time); |
161 std::string filename(StringPrintf("%s%04d%02d%02d%02d%02d%02d%s", | 161 std::string filename(base::StringPrintf("%s%04d%02d%02d%02d%02d%02d%s", |
162 kSnapshotBaseName, the_time.year, the_time.month, the_time.day_of_month, | 162 kSnapshotBaseName, the_time.year, the_time.month, the_time.day_of_month, |
163 the_time.hour, the_time.minute, the_time.second, kSnapshotExtension)); | 163 the_time.hour, the_time.minute, the_time.second, kSnapshotExtension)); |
164 | 164 |
165 base::FilePath snapshot_file = snapshot_directory.AppendASCII(filename); | 165 base::FilePath snapshot_file = snapshot_directory.AppendASCII(filename); |
166 if (file_util::PathExists(snapshot_file)) { | 166 if (file_util::PathExists(snapshot_file)) { |
167 int index = 0; | 167 int index = 0; |
168 std::string suffix; | 168 std::string suffix; |
169 base::FilePath trial_file; | 169 base::FilePath trial_file; |
170 do { | 170 do { |
171 suffix = StringPrintf(" (%d)", ++index); | 171 suffix = base::StringPrintf(" (%d)", ++index); |
172 trial_file = snapshot_file.InsertBeforeExtensionASCII(suffix); | 172 trial_file = snapshot_file.InsertBeforeExtensionASCII(suffix); |
173 } while (file_util::PathExists(trial_file)); | 173 } while (file_util::PathExists(trial_file)); |
174 snapshot_file = trial_file; | 174 snapshot_file = trial_file; |
175 } | 175 } |
176 return snapshot_file; | 176 return snapshot_file; |
177 } | 177 } |
178 | 178 |
179 } // namespace | 179 } // namespace |
180 | 180 |
181 bool GetCurrentTabTitle(const Browser* browser, string16* title) { | 181 bool GetCurrentTabTitle(const Browser* browser, string16* title) { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 void HistoryEnumerator::HistoryQueryComplete( | 684 void HistoryEnumerator::HistoryQueryComplete( |
685 const base::Closure& quit_task, | 685 const base::Closure& quit_task, |
686 HistoryService::Handle request_handle, | 686 HistoryService::Handle request_handle, |
687 history::QueryResults* results) { | 687 history::QueryResults* results) { |
688 for (size_t i = 0; i < results->size(); ++i) | 688 for (size_t i = 0; i < results->size(); ++i) |
689 urls_.push_back((*results)[i].url()); | 689 urls_.push_back((*results)[i].url()); |
690 quit_task.Run(); | 690 quit_task.Run(); |
691 } | 691 } |
692 | 692 |
693 } // namespace ui_test_utils | 693 } // namespace ui_test_utils |
OLD | NEW |