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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 return last_render_widget_host_; | 290 return last_render_widget_host_; |
291 } | 291 } |
292 | 292 |
293 private: | 293 private: |
294 scoped_refptr<content::MessageLoopRunner> message_loop_; | 294 scoped_refptr<content::MessageLoopRunner> message_loop_; |
295 bool created_; | 295 bool created_; |
296 content::RenderWidgetHost* last_render_widget_host_; | 296 content::RenderWidgetHost* last_render_widget_host_; |
297 }; | 297 }; |
298 | 298 |
299 void WaitForTitle(const char* title) { | 299 void WaitForTitle(const char* title) { |
300 base::string16 expected_title(ASCIIToUTF16(title)); | 300 base::string16 expected_title(base::ASCIIToUTF16(title)); |
301 base::string16 error_title(ASCIIToUTF16("FAILED")); | 301 base::string16 error_title(base::ASCIIToUTF16("FAILED")); |
302 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); | 302 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); |
303 title_watcher.AlsoWaitForTitle(error_title); | 303 title_watcher.AlsoWaitForTitle(error_title); |
304 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 304 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
305 } | 305 } |
306 | 306 |
307 void PopupTestHelper(const gfx::Point& padding) { | 307 void PopupTestHelper(const gfx::Point& padding) { |
308 PopupCreatedObserver popup_created_observer; | 308 PopupCreatedObserver popup_created_observer; |
309 popup_created_observer.Reset(); | 309 popup_created_observer.Reset(); |
310 | 310 |
311 content::SimulateKeyPress( | 311 content::SimulateKeyPress( |
312 guest_web_contents(), | 312 guest_web_contents(), |
313 ui::VKEY_C, // C to autocomplete. | 313 ui::VKEY_C, // C to autocomplete. |
314 false, false, false, false); | 314 false, false, false, false); |
315 | 315 |
316 WaitForTitle("PASSED1"); | 316 WaitForTitle("PASSED1"); |
317 | 317 |
318 popup_created_observer.Start(); | 318 popup_created_observer.Start(); |
319 | 319 |
320 content::RenderWidgetHost* popup_rwh = NULL; | 320 content::RenderWidgetHost* popup_rwh = NULL; |
321 popup_rwh = popup_created_observer.last_render_widget_host(); | 321 popup_rwh = popup_created_observer.last_render_widget_host(); |
322 // Popup must be present. | 322 // Popup must be present. |
323 ASSERT_TRUE(popup_rwh); | 323 ASSERT_TRUE(popup_rwh); |
324 ASSERT_TRUE(!popup_rwh->IsRenderView()); | 324 ASSERT_TRUE(!popup_rwh->IsRenderView()); |
325 ASSERT_TRUE(popup_rwh->GetView()); | 325 ASSERT_TRUE(popup_rwh->GetView()); |
326 | 326 |
327 base::string16 expected_title = ASCIIToUTF16("PASSED2"); | 327 base::string16 expected_title = base::ASCIIToUTF16("PASSED2"); |
328 base::string16 error_title = ASCIIToUTF16("FAILED"); | 328 base::string16 error_title = base::ASCIIToUTF16("FAILED"); |
329 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); | 329 content::TitleWatcher title_watcher(guest_web_contents(), expected_title); |
330 title_watcher.AlsoWaitForTitle(error_title); | 330 title_watcher.AlsoWaitForTitle(error_title); |
331 EXPECT_TRUE(content::ExecuteScript(guest_web_contents(), | 331 EXPECT_TRUE(content::ExecuteScript(guest_web_contents(), |
332 "changeTitle();")); | 332 "changeTitle();")); |
333 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 333 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
334 | 334 |
335 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); | 335 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); |
336 // (2, 2) is expected to lie on the first datalist element. | 336 // (2, 2) is expected to lie on the first datalist element. |
337 SimulateRWHMouseClick(popup_rwh, 2, 2); | 337 SimulateRWHMouseClick(popup_rwh, 2, 2); |
338 | 338 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 764 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
765 } | 765 } |
766 | 766 |
767 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, | 767 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
768 PointerLock_PointerLockLostWithFocus) { | 768 PointerLock_PointerLockLostWithFocus) { |
769 TestHelper("testPointerLockLostWithFocus", | 769 TestHelper("testPointerLockLostWithFocus", |
770 "web_view/pointerlock", | 770 "web_view/pointerlock", |
771 NO_TEST_SERVER); | 771 NO_TEST_SERVER); |
772 } | 772 } |
OLD | NEW |