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/browser/page_cycler/page_cycler.h" | 5 #include "chrome/browser/page_cycler/page_cycler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/test/base/chrome_process_util.h" | 18 #include "chrome/test/base/chrome_process_util.h" |
18 #include "chrome/test/perf/perf_test.h" | 19 #include "chrome/test/perf/perf_test.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
23 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
24 | 25 |
25 using content::NavigationController; | 26 using content::NavigationController; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 content::BrowserThread::PostTask(content::BrowserThread::UI, | 226 content::BrowserThread::PostTask(content::BrowserThread::UI, |
226 FROM_HERE, | 227 FROM_HERE, |
227 base::Bind(&PageCycler::Finish, this)); | 228 base::Bind(&PageCycler::Finish, this)); |
228 } | 229 } |
229 } | 230 } |
230 | 231 |
231 void PageCycler::Finish() { | 232 void PageCycler::Finish() { |
232 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 233 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
233 BrowserList::RemoveObserver(this); | 234 BrowserList::RemoveObserver(this); |
234 browser_->OnWindowClosing(); | 235 browser_->OnWindowClosing(); |
235 browser_->ExecuteCommand(IDC_EXIT); | 236 chrome::ExecuteCommand(browser_, IDC_EXIT); |
236 Release(); // Balanced in PageCycler constructor; | 237 Release(); // Balanced in PageCycler constructor; |
237 // (only one of Finish/Abort should be called). | 238 // (only one of Finish/Abort should be called). |
238 } | 239 } |
239 | 240 |
240 void PageCycler::Abort() { | 241 void PageCycler::Abort() { |
241 browser_ = NULL; | 242 browser_ = NULL; |
242 BrowserList::RemoveObserver(this); | 243 BrowserList::RemoveObserver(this); |
243 Release(); // Balanced in PageCycler constructor; | 244 Release(); // Balanced in PageCycler constructor; |
244 // (only one of Finish/Abort should be called). | 245 // (only one of Finish/Abort should be called). |
245 } | 246 } |
246 | 247 |
247 void PageCycler::OnBrowserAdded(Browser* browser) {} | 248 void PageCycler::OnBrowserAdded(Browser* browser) {} |
248 | 249 |
249 void PageCycler::OnBrowserRemoved(Browser* browser) { | 250 void PageCycler::OnBrowserRemoved(Browser* browser) { |
250 if (browser == browser_) { | 251 if (browser == browser_) { |
251 aborted_ = true; | 252 aborted_ = true; |
252 error_.append(ASCIIToUTF16( | 253 error_.append(ASCIIToUTF16( |
253 "Browser was closed before the run was completed.")); | 254 "Browser was closed before the run was completed.")); |
254 DLOG(WARNING) << | 255 DLOG(WARNING) << |
255 "Page Cycler: browser was closed before the run was completed."; | 256 "Page Cycler: browser was closed before the run was completed."; |
256 content::BrowserThread::PostBlockingPoolTask( | 257 content::BrowserThread::PostBlockingPoolTask( |
257 FROM_HERE, | 258 FROM_HERE, |
258 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); | 259 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); |
259 } | 260 } |
260 } | 261 } |
OLD | NEW |