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 | |
564 int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, | 552 int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, |
565 bool forward, bool match_case, int* ordinal) { | 553 bool forward, bool match_case, int* ordinal) { |
566 tab_contents-> | 554 tab_contents-> |
567 find_tab_helper()->StartFinding(search_string, forward, match_case); | 555 find_tab_helper()->StartFinding(search_string, forward, match_case); |
568 FindInPageNotificationObserver observer(tab_contents); | 556 FindInPageNotificationObserver observer(tab_contents); |
569 if (ordinal) | 557 if (ordinal) |
570 *ordinal = observer.active_match_ordinal(); | 558 *ordinal = observer.active_match_ordinal(); |
571 return observer.number_of_matches(); | 559 return observer.number_of_matches(); |
572 } | 560 } |
573 | 561 |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1053 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
1066 } | 1054 } |
1067 | 1055 |
1068 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1056 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
1069 DCHECK(bitmap); | 1057 DCHECK(bitmap); |
1070 SnapshotTaker taker; | 1058 SnapshotTaker taker; |
1071 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1059 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
1072 } | 1060 } |
1073 | 1061 |
1074 } // namespace ui_test_utils | 1062 } // namespace ui_test_utils |
OLD | NEW |