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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
18 #include "base/json/json_reader.h" | 18 #include "base/json/json_reader.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/process_util.h" | 22 #include "base/process_util.h" |
23 #include "base/rand_util.h" | 23 #include "base/rand_util.h" |
24 #include "base/string_number_conversions.h" | 24 #include "base/string_number_conversions.h" |
25 #include "base/test/test_timeouts.h" | 25 #include "base/test/test_timeouts.h" |
| 26 #include "base/threading/platform_thread.h" |
26 #include "base/time.h" | 27 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
28 #include "base/values.h" | 29 #include "base/values.h" |
29 #include "chrome/browser/bookmarks/bookmark_model.h" | 30 #include "chrome/browser/bookmarks/bookmark_model.h" |
30 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/history/history.h" | 32 #include "chrome/browser/history/history.h" |
32 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
33 #include "chrome/browser/search_engines/template_url_service.h" | 34 #include "chrome/browser/search_engines/template_url_service.h" |
34 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 35 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
35 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 36 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) { | 372 Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) { |
372 Browser* new_browser = GetBrowserNotInSet(excluded_browsers); | 373 Browser* new_browser = GetBrowserNotInSet(excluded_browsers); |
373 if (new_browser == NULL) { | 374 if (new_browser == NULL) { |
374 new_browser = WaitForNewBrowser(); | 375 new_browser = WaitForNewBrowser(); |
375 // The new browser should never be in |excluded_browsers|. | 376 // The new browser should never be in |excluded_browsers|. |
376 DCHECK(!ContainsKey(excluded_browsers, new_browser)); | 377 DCHECK(!ContainsKey(excluded_browsers, new_browser)); |
377 } | 378 } |
378 return new_browser; | 379 return new_browser; |
379 } | 380 } |
380 | 381 |
| 382 void WaitEventSignaled(base::WaitableEvent* event) { |
| 383 while (!event->IsSignaled()) { |
| 384 base::PlatformThread::YieldCurrentThread(); |
| 385 RunAllPendingInMessageLoop(); |
| 386 } |
| 387 } |
| 388 |
381 void OpenURLOffTheRecord(Profile* profile, const GURL& url) { | 389 void OpenURLOffTheRecord(Profile* profile, const GURL& url) { |
382 Browser::OpenURLOffTheRecord(profile, url); | 390 Browser::OpenURLOffTheRecord(profile, url); |
383 Browser* browser = browser::FindTabbedBrowser( | 391 Browser* browser = browser::FindTabbedBrowser( |
384 profile->GetOffTheRecordProfile(), false); | 392 profile->GetOffTheRecordProfile(), false); |
385 WaitForNavigations(&browser->GetSelectedWebContents()->GetController(), 1); | 393 WaitForNavigations(&browser->GetSelectedWebContents()->GetController(), 1); |
386 } | 394 } |
387 | 395 |
388 void NavigateToURL(browser::NavigateParams* params) { | 396 void NavigateToURL(browser::NavigateParams* params) { |
389 content::TestNavigationObserver observer( | 397 content::TestNavigationObserver observer( |
390 content::NotificationService::AllSources(), NULL, 1); | 398 content::NotificationService::AllSources(), NULL, 1); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 int state, | 1272 int state, |
1265 const base::Closure& followup) { | 1273 const base::Closure& followup) { |
1266 if (!followup.is_null()) | 1274 if (!followup.is_null()) |
1267 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); | 1275 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); |
1268 else | 1276 else |
1269 ui_controls::SendMouseEvents(button, state); | 1277 ui_controls::SendMouseEvents(button, state); |
1270 } | 1278 } |
1271 | 1279 |
1272 } // namespace internal | 1280 } // namespace internal |
1273 } // namespace ui_test_utils | 1281 } // namespace ui_test_utils |
OLD | NEW |