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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 content::Source<NavigationController>(controller), NULL, | 335 content::Source<NavigationController>(controller), NULL, |
336 number_of_navigations); | 336 number_of_navigations); |
337 observer.WaitForObservation( | 337 observer.WaitForObservation( |
338 base::Bind(&ui_test_utils::RunMessageLoop), | 338 base::Bind(&ui_test_utils::RunMessageLoop), |
339 base::Bind(&MessageLoop::Quit, | 339 base::Bind(&MessageLoop::Quit, |
340 base::Unretained(MessageLoopForUI::current()))); | 340 base::Unretained(MessageLoopForUI::current()))); |
341 } | 341 } |
342 | 342 |
343 void WaitForNewTab(Browser* browser) { | 343 void WaitForNewTab(Browser* browser) { |
344 TestNotificationObserver observer; | 344 TestNotificationObserver observer; |
345 RegisterAndWait(&observer, content::NOTIFICATION_TAB_ADDED, | 345 RegisterAndWait(&observer, chrome::NOTIFICATION_TAB_ADDED, |
346 content::Source<content::WebContentsDelegate>(browser)); | 346 content::Source<content::WebContentsDelegate>(browser)); |
347 } | 347 } |
348 | 348 |
349 void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { | 349 void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { |
350 TestNotificationObserver observer; | 350 TestNotificationObserver observer; |
351 RegisterAndWait(&observer, | 351 RegisterAndWait(&observer, |
352 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 352 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
353 content::Source<ExtensionAction>(browser_action)); | 353 content::Source<ExtensionAction>(browser_action)); |
354 } | 354 } |
355 | 355 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 number_of_navigations); | 426 number_of_navigations); |
427 | 427 |
428 std::set<Browser*> initial_browsers; | 428 std::set<Browser*> initial_browsers; |
429 for (std::vector<Browser*>::const_iterator iter = BrowserList::begin(); | 429 for (std::vector<Browser*>::const_iterator iter = BrowserList::begin(); |
430 iter != BrowserList::end(); | 430 iter != BrowserList::end(); |
431 ++iter) { | 431 ++iter) { |
432 initial_browsers.insert(*iter); | 432 initial_browsers.insert(*iter); |
433 } | 433 } |
434 | 434 |
435 WindowedNotificationObserver tab_added_observer( | 435 WindowedNotificationObserver tab_added_observer( |
436 content::NOTIFICATION_TAB_ADDED, | 436 chrome::NOTIFICATION_TAB_ADDED, |
437 content::NotificationService::AllSources()); | 437 content::NotificationService::AllSources()); |
438 | 438 |
439 WindowedNotificationObserver auth_observer( | 439 WindowedNotificationObserver auth_observer( |
440 chrome::NOTIFICATION_AUTH_NEEDED, | 440 chrome::NOTIFICATION_AUTH_NEEDED, |
441 content::NotificationService::AllSources()); | 441 content::NotificationService::AllSources()); |
442 | 442 |
443 browser->OpenURL(OpenURLParams( | 443 browser->OpenURL(OpenURLParams( |
444 url, Referrer(), disposition, content::PAGE_TRANSITION_TYPED, false)); | 444 url, Referrer(), disposition, content::PAGE_TRANSITION_TYPED, false)); |
445 if (browser_test_flags & BROWSER_TEST_WAIT_FOR_BROWSER) | 445 if (browser_test_flags & BROWSER_TEST_WAIT_FOR_BROWSER) |
446 browser = WaitForBrowserNotInSet(initial_browsers); | 446 browser = WaitForBrowserNotInSet(initial_browsers); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 if (waiting_for_ == source || | 967 if (waiting_for_ == source || |
968 (running_ && waiting_for_ == content::NotificationService::AllSources()))
{ | 968 (running_ && waiting_for_ == content::NotificationService::AllSources()))
{ |
969 seen_ = true; | 969 seen_ = true; |
970 if (running_) | 970 if (running_) |
971 MessageLoopForUI::current()->Quit(); | 971 MessageLoopForUI::current()->Quit(); |
972 } else { | 972 } else { |
973 sources_seen_.insert(source.map_key()); | 973 sources_seen_.insert(source.map_key()); |
974 } | 974 } |
975 } | 975 } |
976 | 976 |
| 977 WindowedTabAddedNotificationObserver::WindowedTabAddedNotificationObserver( |
| 978 const content::NotificationSource& source) |
| 979 : WindowedNotificationObserver(chrome::NOTIFICATION_TAB_ADDED, source) { |
| 980 } |
| 981 |
977 TitleWatcher::TitleWatcher(WebContents* web_contents, | 982 TitleWatcher::TitleWatcher(WebContents* web_contents, |
978 const string16& expected_title) | 983 const string16& expected_title) |
979 : web_contents_(web_contents), | 984 : web_contents_(web_contents), |
980 expected_title_observed_(false), | 985 expected_title_observed_(false), |
981 quit_loop_on_observation_(false) { | 986 quit_loop_on_observation_(false) { |
982 EXPECT_TRUE(web_contents != NULL); | 987 EXPECT_TRUE(web_contents != NULL); |
983 expected_titles_.push_back(expected_title); | 988 expected_titles_.push_back(expected_title); |
984 notification_registrar_.Add(this, | 989 notification_registrar_.Add(this, |
985 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, | 990 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, |
986 content::Source<WebContents>(web_contents)); | 991 content::Source<WebContents>(web_contents)); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 int state, | 1181 int state, |
1177 const base::Closure& followup) { | 1182 const base::Closure& followup) { |
1178 if (!followup.is_null()) | 1183 if (!followup.is_null()) |
1179 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); | 1184 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); |
1180 else | 1185 else |
1181 ui_controls::SendMouseEvents(button, state); | 1186 ui_controls::SendMouseEvents(button, state); |
1182 } | 1187 } |
1183 | 1188 |
1184 } // namespace internal | 1189 } // namespace internal |
1185 } // namespace ui_test_utils | 1190 } // namespace ui_test_utils |
OLD | NEW |