OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 542 } |
543 | 543 |
544 void CrashTab(TabContents* tab) { | 544 void CrashTab(TabContents* tab) { |
545 content::RenderProcessHost* rph = tab->render_view_host()->process(); | 545 content::RenderProcessHost* rph = tab->render_view_host()->process(); |
546 base::KillProcess(rph->GetHandle(), 0, false); | 546 base::KillProcess(rph->GetHandle(), 0, false); |
547 TestNotificationObserver observer; | 547 TestNotificationObserver observer; |
548 RegisterAndWait(&observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 548 RegisterAndWait(&observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
549 content::Source<content::RenderProcessHost>(rph)); | 549 content::Source<content::RenderProcessHost>(rph)); |
550 } | 550 } |
551 | 551 |
| 552 void WaitForFocusChange(TabContents* tab_contents) { |
| 553 TestNotificationObserver observer; |
| 554 RegisterAndWait(&observer, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 555 content::Source<TabContents>(tab_contents)); |
| 556 } |
| 557 |
| 558 void WaitForFocusInBrowser(Browser* browser) { |
| 559 TestNotificationObserver observer; |
| 560 RegisterAndWait(&observer, chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
| 561 content::Source<Browser>(browser)); |
| 562 } |
| 563 |
552 int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, | 564 int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, |
553 bool forward, bool match_case, int* ordinal) { | 565 bool forward, bool match_case, int* ordinal) { |
554 tab_contents-> | 566 tab_contents-> |
555 find_tab_helper()->StartFinding(search_string, forward, match_case); | 567 find_tab_helper()->StartFinding(search_string, forward, match_case); |
556 FindInPageNotificationObserver observer(tab_contents); | 568 FindInPageNotificationObserver observer(tab_contents); |
557 if (ordinal) | 569 if (ordinal) |
558 *ordinal = observer.active_match_ordinal(); | 570 *ordinal = observer.active_match_ordinal(); |
559 return observer.number_of_matches(); | 571 return observer.number_of_matches(); |
560 } | 572 } |
561 | 573 |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1065 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
1054 } | 1066 } |
1055 | 1067 |
1056 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1068 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
1057 DCHECK(bitmap); | 1069 DCHECK(bitmap); |
1058 SnapshotTaker taker; | 1070 SnapshotTaker taker; |
1059 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1071 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
1060 } | 1072 } |
1061 | 1073 |
1062 } // namespace ui_test_utils | 1074 } // namespace ui_test_utils |
OLD | NEW |