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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2709813007: Remove WebViewClient::showVirtualKeyboardOnElementFocus() (Closed)
Patch Set: Rebased Created 3 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
OLDNEW
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 11394 matching lines...) Expand 10 before | Expand all | Expand 10 after
11405 FrameTestHelpers::TestWebViewClient openerWebViewClient; 11405 FrameTestHelpers::TestWebViewClient openerWebViewClient;
11406 FrameTestHelpers::WebViewHelper openerHelper; 11406 FrameTestHelpers::WebViewHelper openerHelper;
11407 openerHelper.initialize(false, nullptr, &openerWebViewClient); 11407 openerHelper.initialize(false, nullptr, &openerWebViewClient);
11408 FrameTestHelpers::WebViewHelper helper; 11408 FrameTestHelpers::WebViewHelper helper;
11409 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); 11409 helper.initializeWithOpener(openerHelper.webView()->mainFrame());
11410 11410
11411 openerHelper.reset(); 11411 openerHelper.reset();
11412 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); 11412 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener());
11413 } 11413 }
11414 11414
11415 class ShowVirtualKeyboardObserverWidgetClient
11416 : public FrameTestHelpers::TestWebWidgetClient {
11417 public:
11418 ShowVirtualKeyboardObserverWidgetClient() : m_didShowVirtualKeyboard(false) {}
11419
11420 void showVirtualKeyboardOnElementFocus() override {
11421 m_didShowVirtualKeyboard = true;
11422 }
11423
11424 bool didShowVirtualKeyboard() const { return m_didShowVirtualKeyboard; }
11425
11426 private:
11427 bool m_didShowVirtualKeyboard;
11428 };
11429
11430 TEST_F(WebFrameTest, ShowVirtualKeyboardOnElementFocus) {
11431 FrameTestHelpers::TestWebViewClient viewClient;
11432 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
11433
11434 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
11435 view->setMainFrame(remoteClient.frame());
11436
11437 ShowVirtualKeyboardObserverWidgetClient childWidgetClient;
11438 WebLocalFrameImpl* childFrame = FrameTestHelpers::createLocalChild(
11439 view->mainFrame()->toWebRemoteFrame(), WebString(), nullptr,
11440 &childWidgetClient);
11441 EXPECT_EQ(childFrame, view->focusedFrame());
11442
11443 // Simulate an input element focus leading to Element::focus() call with a
11444 // user gesture.
11445 static_cast<WebViewImpl*>(view)
11446 ->chromeClient()
11447 .showVirtualKeyboardOnElementFocus(childFrame->frame());
11448
11449 // Verify that the right WebWidgetClient has been notified.
11450 EXPECT_TRUE(childWidgetClient.didShowVirtualKeyboard());
11451 view->close();
dcheng 2017/02/23 19:28:48 FWIW, I don't think this unit test adds much and w
EhsanK 2017/02/23 21:06:09 I agree with not having the test. I intended to lo
dcheng 2017/02/23 21:10:21 One option is to use the helpers from FrameTestHel
EhsanK 2017/02/27 16:59:56 Thanks! I also had to make it a proper WebFrameSwa
11452 }
11453
11415 } // namespace blink 11454 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp ('k') | third_party/WebKit/public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698