OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/shell_window.h" | 5 #include "apps/shell_window.h" |
6 #include "apps/shell_window_registry.h" | 6 #include "apps/shell_window_registry.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 mouse_event.x = mouse_event.windowX = x; | 263 mouse_event.x = mouse_event.windowX = x; |
264 mouse_event.y = mouse_event.windowY = y; | 264 mouse_event.y = mouse_event.windowY = y; |
265 mouse_event.modifiers = 0; | 265 mouse_event.modifiers = 0; |
266 | 266 |
267 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 267 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
268 rwh->ForwardMouseEvent(mouse_event); | 268 rwh->ForwardMouseEvent(mouse_event); |
269 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 269 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
270 rwh->ForwardMouseEvent(mouse_event); | 270 rwh->ForwardMouseEvent(mouse_event); |
271 } | 271 } |
272 | 272 |
| 273 // TODO(lazyboy): implement |
273 class PopupCreatedObserver { | 274 class PopupCreatedObserver { |
274 public: | 275 public: |
275 PopupCreatedObserver() : created_(false), last_render_widget_host_(NULL) { | 276 PopupCreatedObserver() : created_(false), last_render_widget_host_(NULL) { |
276 created_callback_ = base::Bind( | |
277 &PopupCreatedObserver::CreatedCallback, base::Unretained(this)); | |
278 content::RenderWidgetHost::AddCreatedCallback(created_callback_); | |
279 } | 277 } |
280 virtual ~PopupCreatedObserver() { | 278 virtual ~PopupCreatedObserver() { |
281 content::RenderWidgetHost::RemoveCreatedCallback(created_callback_); | |
282 } | 279 } |
283 void Reset() { | 280 void Reset() { |
284 created_ = false; | 281 created_ = false; |
285 } | 282 } |
286 void Start() { | 283 void Start() { |
287 if (created_) | 284 if (created_) |
288 return; | 285 return; |
289 message_loop_ = new content::MessageLoopRunner; | 286 message_loop_ = new content::MessageLoopRunner; |
290 message_loop_->Run(); | 287 message_loop_->Run(); |
291 } | 288 } |
292 content::RenderWidgetHost* last_render_widget_host() { | 289 content::RenderWidgetHost* last_render_widget_host() { |
293 return last_render_widget_host_; | 290 return last_render_widget_host_; |
294 } | 291 } |
295 | 292 |
296 private: | 293 private: |
297 void CreatedCallback(content::RenderWidgetHost* rwh) { | |
298 last_render_widget_host_ = rwh; | |
299 if (message_loop_.get()) | |
300 message_loop_->Quit(); | |
301 else | |
302 created_ = true; | |
303 } | |
304 content::RenderWidgetHost::CreatedCallback created_callback_; | |
305 scoped_refptr<content::MessageLoopRunner> message_loop_; | 294 scoped_refptr<content::MessageLoopRunner> message_loop_; |
306 bool created_; | 295 bool created_; |
307 content::RenderWidgetHost* last_render_widget_host_; | 296 content::RenderWidgetHost* last_render_widget_host_; |
308 }; | 297 }; |
309 | 298 |
310 void WaitForTitle(const char* title) { | 299 void WaitForTitle(const char* title) { |
311 string16 expected_title(ASCIIToUTF16(title)); | 300 string16 expected_title(ASCIIToUTF16(title)); |
312 string16 error_title(ASCIIToUTF16("FAILED")); | 301 string16 error_title(ASCIIToUTF16("FAILED")); |
313 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); | 302 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); |
314 title_watcher.AlsoWaitForTitle(error_title); | 303 title_watcher.AlsoWaitForTitle(error_title); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 756 |
768 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 757 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
769 } | 758 } |
770 | 759 |
771 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, | 760 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
772 PointerLock_PointerLockLostWithFocus) { | 761 PointerLock_PointerLockLostWithFocus) { |
773 TestHelper("testPointerLockLostWithFocus", | 762 TestHelper("testPointerLockLostWithFocus", |
774 "web_view/pointerlock", | 763 "web_view/pointerlock", |
775 NO_TEST_SERVER); | 764 NO_TEST_SERVER); |
776 } | 765 } |
OLD | NEW |