OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/json_reader.h" | 7 #include "base/json_reader.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
13 #include "chrome/browser/dom_operation_notification_details.h" | 13 #include "chrome/browser/dom_operation_notification_details.h" |
14 #include "chrome/browser/download/download_manager.h" | 14 #include "chrome/browser/download/download_manager.h" |
15 #include "chrome/browser/tab_contents/navigation_controller.h" | 15 #include "chrome/browser/tab_contents/navigation_controller.h" |
16 #include "chrome/browser/tab_contents/navigation_entry.h" | 16 #include "chrome/browser/tab_contents/navigation_entry.h" |
17 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
20 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
21 #if defined (OS_WIN) | 21 #if defined(TOOLKIT_VIEWS) |
22 #include "views/widget/accelerator_handler.h" | 22 #include "views/focus/accelerator_handler.h" |
23 #endif | 23 #endif |
24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
26 | 26 |
27 namespace ui_test_utils { | 27 namespace ui_test_utils { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Used to block until a navigation completes. | 31 // Used to block until a navigation completes. |
32 class NavigationNotificationObserver : public NotificationObserver { | 32 class NavigationNotificationObserver : public NotificationObserver { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 DISALLOW_COPY_AND_ASSIGN(CrashedRenderProcessObserver); | 254 DISALLOW_COPY_AND_ASSIGN(CrashedRenderProcessObserver); |
255 }; | 255 }; |
256 | 256 |
257 } // namespace | 257 } // namespace |
258 | 258 |
259 void RunMessageLoop() { | 259 void RunMessageLoop() { |
260 MessageLoopForUI* loop = MessageLoopForUI::current(); | 260 MessageLoopForUI* loop = MessageLoopForUI::current(); |
261 bool did_allow_task_nesting = loop->NestableTasksAllowed(); | 261 bool did_allow_task_nesting = loop->NestableTasksAllowed(); |
262 loop->SetNestableTasksAllowed(true); | 262 loop->SetNestableTasksAllowed(true); |
263 #if defined (OS_WIN) | 263 #if defined(TOOLKIT_VIEWS) |
264 views::AcceleratorHandler handler; | 264 views::AcceleratorHandler handler; |
265 loop->Run(&handler); | 265 loop->Run(&handler); |
| 266 #elif defined(OS_LINUX) |
| 267 loop->Run(NULL); |
266 #else | 268 #else |
267 loop->Run(); | 269 loop->Run(); |
268 #endif | 270 #endif |
269 loop->SetNestableTasksAllowed(did_allow_task_nesting); | 271 loop->SetNestableTasksAllowed(did_allow_task_nesting); |
270 } | 272 } |
271 | 273 |
272 bool GetCurrentTabTitle(const Browser* browser, string16* title) { | 274 bool GetCurrentTabTitle(const Browser* browser, string16* title) { |
273 TabContents* tab_contents = browser->GetSelectedTabContents(); | 275 TabContents* tab_contents = browser->GetSelectedTabContents(); |
274 if (!tab_contents) | 276 if (!tab_contents) |
275 return false; | 277 return false; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 return observer.WaitForAppModalDialog(); | 397 return observer.WaitForAppModalDialog(); |
396 } | 398 } |
397 | 399 |
398 void CrashTab(TabContents* tab) { | 400 void CrashTab(TabContents* tab) { |
399 RenderProcessHost* rph = tab->render_view_host()->process(); | 401 RenderProcessHost* rph = tab->render_view_host()->process(); |
400 base::KillProcess(rph->process().handle(), 0, false); | 402 base::KillProcess(rph->process().handle(), 0, false); |
401 CrashedRenderProcessObserver crash_observer(rph); | 403 CrashedRenderProcessObserver crash_observer(rph); |
402 } | 404 } |
403 | 405 |
404 } // namespace ui_test_utils | 406 } // namespace ui_test_utils |
OLD | NEW |