Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 #include "platform/testing/UnitTestHelpers.h" | 67 #include "platform/testing/UnitTestHelpers.h" |
| 68 #include "public/platform/Platform.h" | 68 #include "public/platform/Platform.h" |
| 69 #include "public/platform/WebDisplayMode.h" | 69 #include "public/platform/WebDisplayMode.h" |
| 70 #include "public/platform/WebDragData.h" | 70 #include "public/platform/WebDragData.h" |
| 71 #include "public/platform/WebDragOperation.h" | 71 #include "public/platform/WebDragOperation.h" |
| 72 #include "public/platform/WebFloatPoint.h" | 72 #include "public/platform/WebFloatPoint.h" |
| 73 #include "public/platform/WebInputEvent.h" | 73 #include "public/platform/WebInputEvent.h" |
| 74 #include "public/platform/WebLayerTreeView.h" | 74 #include "public/platform/WebLayerTreeView.h" |
| 75 #include "public/platform/WebMockClipboard.h" | 75 #include "public/platform/WebMockClipboard.h" |
| 76 #include "public/platform/WebSize.h" | 76 #include "public/platform/WebSize.h" |
| 77 #include "public/platform/WebTextInputType.h" | |
| 77 #include "public/platform/WebThread.h" | 78 #include "public/platform/WebThread.h" |
| 78 #include "public/platform/WebURLLoaderMockFactory.h" | 79 #include "public/platform/WebURLLoaderMockFactory.h" |
| 79 #include "public/web/WebAutofillClient.h" | 80 #include "public/web/WebAutofillClient.h" |
| 80 #include "public/web/WebCache.h" | 81 #include "public/web/WebCache.h" |
| 81 #include "public/web/WebDateTimeChooserCompletion.h" | 82 #include "public/web/WebDateTimeChooserCompletion.h" |
| 82 #include "public/web/WebDeviceEmulationParams.h" | 83 #include "public/web/WebDeviceEmulationParams.h" |
| 83 #include "public/web/WebDocument.h" | 84 #include "public/web/WebDocument.h" |
| 84 #include "public/web/WebElement.h" | 85 #include "public/web/WebElement.h" |
| 85 #include "public/web/WebFrame.h" | 86 #include "public/web/WebFrame.h" |
| 86 #include "public/web/WebFrameClient.h" | 87 #include "public/web/WebFrameClient.h" |
| (...skipping 4267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4354 .translate(-50, -55) | 4355 .translate(-50, -55) |
| 4355 .translate(50, 55) | 4356 .translate(50, 55) |
| 4356 .scale(1. / 2.f); | 4357 .scale(1. / 2.f); |
| 4357 EXPECT_EQ(expectedMatrix, | 4358 EXPECT_EQ(expectedMatrix, |
| 4358 webViewImpl->getDeviceEmulationTransformForTesting()); | 4359 webViewImpl->getDeviceEmulationTransformForTesting()); |
| 4359 // visibleContentRect doesn't change. | 4360 // visibleContentRect doesn't change. |
| 4360 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4361 EXPECT_EQ(IntRect(50, 55, 50, 75), |
| 4361 *devToolsEmulator->visibleContentRectForPainting()); | 4362 *devToolsEmulator->visibleContentRectForPainting()); |
| 4362 } | 4363 } |
| 4363 | 4364 |
| 4365 TEST_P(WebViewTest, CompositionIsRemovedOnDeletingElement) { | |
|
Changwan Ryu
2016/11/24 09:34:38
Hmm... Could you also rename this to something lik
yosin_UTC9
2016/11/25 01:28:23
Can we do this test in |InputMethodControllerTest|
yoichio
2016/11/25 09:19:41
Done.
| |
| 4366 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( | |
| 4367 "data:text/html, <input id='a' /><br><input type='te' id='b' />"); | |
|
Changwan Ryu
2016/11/24 09:23:51
typo: te -> tel
yoichio
2016/11/25 09:19:41
Done.
| |
| 4368 webView->settings()->setJavaScriptEnabled(true); | |
| 4369 // webView->setInitialFocus(false); | |
|
Changwan Ryu
2016/11/24 09:15:00
could you remove this?
yoichio
2016/11/25 09:19:41
Done.
| |
| 4370 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | |
| 4371 | |
| 4372 WebInputMethodController* inputMethodController = | |
| 4373 frame->frameWidget()->getActiveWebInputMethodController(); | |
| 4374 | |
| 4375 EXPECT_EQ(WebTextInputTypeNone, webView->textInputType()); | |
| 4376 // Focus element 'a'. | |
| 4377 frame->executeScript( | |
| 4378 WebScriptSource("document.getElementById('a').focus();")); | |
| 4379 EXPECT_EQ(WebTextInputTypeText, webView->textInputType()); | |
| 4380 | |
| 4381 // The test requires non-empty composition. | |
| 4382 std::string compositionText("hello"); | |
| 4383 WebVector<WebCompositionUnderline> emptyUnderlines; | |
| 4384 inputMethodController->setComposition("hello", emptyUnderlines, 5, 5); | |
| 4385 EXPECT_EQ(WebTextInputTypeText, webView->textInputType()); | |
| 4386 | |
| 4387 // Remove element 'a'. | |
| 4388 frame->executeScript( | |
| 4389 WebScriptSource("document.getElementById('a').outerHTML = '';")); | |
| 4390 EXPECT_EQ(WebTextInputTypeNone, webView->textInputType()); | |
| 4391 | |
| 4392 frame->executeScript( | |
| 4393 WebScriptSource("document.getElementById('b').focus();")); | |
| 4394 // TODO: EXPECT_EQ(WebTextInputTypeTelephone, webView->textInputType()); | |
|
Changwan Ryu
2016/11/24 09:15:00
Hmm... Does it still not fix crbug.com/664317?
I
Changwan Ryu
2016/11/24 09:34:38
If the test passes after typo is fixed, then this
yoichio
2016/11/25 09:19:41
Done.
| |
| 4395 | |
| 4396 inputMethodController->finishComposingText( | |
| 4397 WebInputMethodController::KeepSelection); | |
| 4398 // TODO: EXPECT_EQ(WebTextInputTypeTelephone, webView->textInputType()); | |
| 4399 } | |
| 4400 | |
| 4364 } // namespace blink | 4401 } // namespace blink |
| OLD | NEW |