Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/test/ui_test_utils.cc

Issue 27122: Another attempt at landing the new browser focus interactive ui tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/interactive_ui/interactive_ui.vcproj ('k') | chrome/test/unit/chrome_test_suite.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/ui_test_utils.h" 5 #include "chrome/test/ui_test_utils.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/tab_contents/navigation_controller.h" 9 #include "chrome/browser/tab_contents/navigation_controller.h"
10 #include "chrome/browser/tab_contents/web_contents.h" 10 #include "chrome/browser/tab_contents/web_contents.h"
11 #include "chrome/common/notification_registrar.h" 11 #include "chrome/common/notification_registrar.h"
12 #include "chrome/common/notification_service.h" 12 #include "chrome/common/notification_service.h"
13 #include "chrome/views/accelerator_handler.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 15
15 namespace ui_test_utils { 16 namespace ui_test_utils {
16 17
17 namespace { 18 namespace {
18 19
19 // Used to block until a navigation completes. 20 // Used to block until a navigation completes.
20 class NavigationNotificationObserver : public NotificationObserver { 21 class NavigationNotificationObserver : public NotificationObserver {
21 public: 22 public:
22 explicit NavigationNotificationObserver(NavigationController* controller) 23 explicit NavigationNotificationObserver(NavigationController* controller)
(...skipping 29 matching lines...) Expand all
52 53
53 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); 54 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver);
54 }; 55 };
55 56
56 } // namespace 57 } // namespace
57 58
58 void RunMessageLoop() { 59 void RunMessageLoop() {
59 MessageLoopForUI* loop = MessageLoopForUI::current(); 60 MessageLoopForUI* loop = MessageLoopForUI::current();
60 bool did_allow_task_nesting = loop->NestableTasksAllowed(); 61 bool did_allow_task_nesting = loop->NestableTasksAllowed();
61 loop->SetNestableTasksAllowed(true); 62 loop->SetNestableTasksAllowed(true);
62 loop->Run(NULL); 63 views::AcceleratorHandler handler;
64 loop->Run(&handler);
63 loop->SetNestableTasksAllowed(did_allow_task_nesting); 65 loop->SetNestableTasksAllowed(did_allow_task_nesting);
64 } 66 }
65 67
66 void WaitForNavigation(NavigationController* controller) { 68 void WaitForNavigation(NavigationController* controller) {
67 NavigationNotificationObserver observer(controller); 69 NavigationNotificationObserver observer(controller);
68 } 70 }
69 71
70 void NavigateToURL(Browser* browser, const GURL& url) { 72 void NavigateToURL(Browser* browser, const GURL& url) {
71 NavigationController* controller = 73 NavigationController* controller =
72 browser->GetSelectedTabContents()->controller(); 74 browser->GetSelectedTabContents()->controller();
73 browser->OpenURLFromTab(browser->GetSelectedTabContents(), url, GURL(), 75 browser->OpenURLFromTab(browser->GetSelectedTabContents(), url, GURL(),
74 CURRENT_TAB, PageTransition::TYPED); 76 CURRENT_TAB, PageTransition::TYPED);
75 WaitForNavigation(controller); 77 WaitForNavigation(controller);
76 } 78 }
77 79
78 } // namespace ui_test_utils 80 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/test/interactive_ui/interactive_ui.vcproj ('k') | chrome/test/unit/chrome_test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698