| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 11383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11394 &mainFrameClient); | 11394 &mainFrameClient); |
| 11395 | 11395 |
| 11396 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11396 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11397 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11397 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11398 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11398 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11399 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11399 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11400 | 11400 |
| 11401 webViewHelper.reset(); | 11401 webViewHelper.reset(); |
| 11402 } | 11402 } |
| 11403 | 11403 |
| 11404 class ShowVirtualKeyboardObserverWidgetClient |
| 11405 : public FrameTestHelpers::TestWebWidgetClient { |
| 11406 public: |
| 11407 ShowVirtualKeyboardObserverWidgetClient() : m_didShowVirtualKeyboard(false) {} |
| 11408 |
| 11409 void showVirtualKeyboardOnElementFocus() override { |
| 11410 m_didShowVirtualKeyboard = true; |
| 11411 } |
| 11412 |
| 11413 bool didShowVirtualKeyboard() const { return m_didShowVirtualKeyboard; } |
| 11414 |
| 11415 private: |
| 11416 bool m_didShowVirtualKeyboard; |
| 11417 }; |
| 11418 |
| 11419 TEST_F(WebFrameTest, ShowVirtualKeyboardOnElementFocus) { |
| 11420 FrameTestHelpers::TestWebViewClient viewClient; |
| 11421 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 11422 |
| 11423 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 11424 view->setMainFrame(remoteClient.frame()); |
| 11425 |
| 11426 ShowVirtualKeyboardObserverWidgetClient childWidgetClient; |
| 11427 WebLocalFrameImpl* childFrame = FrameTestHelpers::createLocalChild( |
| 11428 view->mainFrame()->toWebRemoteFrame(), WebString(), nullptr, |
| 11429 &childWidgetClient); |
| 11430 EXPECT_EQ(childFrame, view->focusedFrame()); |
| 11431 |
| 11432 // Simulate an input element focus leading to Element::focus() call with a |
| 11433 // user gesture. |
| 11434 static_cast<WebViewImpl*>(view) |
| 11435 ->chromeClient() |
| 11436 .showVirtualKeyboardOnElementFocus(childFrame->frame()); |
| 11437 |
| 11438 // Verify that the right WebWidgetClient has been notified. |
| 11439 EXPECT_TRUE(childWidgetClient.didShowVirtualKeyboard()); |
| 11440 view->close(); |
| 11441 } |
| 11442 |
| 11404 } // namespace blink | 11443 } // namespace blink |
| OLD | NEW |