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

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

Issue 2370663002: Remove logic to reset input method more than needed (Closed)
Patch Set: fixed handle issue in another CL Created 3 years, 10 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) 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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 EXPECT_EQ(6, info.selectionStart); 1543 EXPECT_EQ(6, info.selectionStart);
1544 EXPECT_EQ(11, info.selectionEnd); 1544 EXPECT_EQ(11, info.selectionEnd);
1545 EXPECT_EQ(6, info.compositionStart); 1545 EXPECT_EQ(6, info.compositionStart);
1546 EXPECT_EQ(11, info.compositionEnd); 1546 EXPECT_EQ(11, info.compositionEnd);
1547 1547
1548 frame->setEditableSelectionOffsets(2, 2); 1548 frame->setEditableSelectionOffsets(2, 2);
1549 info = activeInputMethodController->textInputInfo(); 1549 info = activeInputMethodController->textInputInfo();
1550 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); 1550 EXPECT_EQ("hello world", std::string(info.value.utf8().data()));
1551 EXPECT_EQ(2, info.selectionStart); 1551 EXPECT_EQ(2, info.selectionStart);
1552 EXPECT_EQ(2, info.selectionEnd); 1552 EXPECT_EQ(2, info.selectionEnd);
1553 EXPECT_EQ(-1, info.compositionStart); 1553 // Composition range should be reset by browser process or keyboard apps.
1554 EXPECT_EQ(-1, info.compositionEnd); 1554 EXPECT_EQ(6, info.compositionStart);
1555 EXPECT_EQ(11, info.compositionEnd);
1555 } 1556 }
1556 1557
1557 TEST_P(WebViewTest, IsSelectionAnchorFirst) { 1558 TEST_P(WebViewTest, IsSelectionAnchorFirst) {
1558 registerMockedHttpURLLoad("input_field_populated.html"); 1559 registerMockedHttpURLLoad("input_field_populated.html");
1559 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( 1560 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(
1560 m_baseURL + "input_field_populated.html"); 1561 m_baseURL + "input_field_populated.html");
1561 WebLocalFrame* frame = webView->mainFrameImpl(); 1562 WebLocalFrame* frame = webView->mainFrameImpl();
1562 1563
1563 webView->setInitialFocus(false); 1564 webView->setInitialFocus(false);
1564 frame->setEditableSelectionOffsets(4, 10); 1565 frame->setEditableSelectionOffsets(4, 10);
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 WebInputMethodController* activeInputMethodController = 2359 WebInputMethodController* activeInputMethodController =
2359 frame->frameWidget()->getActiveWebInputMethodController(); 2360 frame->frameWidget()->getActiveWebInputMethodController();
2360 EXPECT_TRUE(tapElementById(WebInputEvent::GestureTap, target)); 2361 EXPECT_TRUE(tapElementById(WebInputEvent::GestureTap, target));
2361 WebVector<WebCompositionUnderline> emptyUnderlines; 2362 WebVector<WebCompositionUnderline> emptyUnderlines;
2362 frame->setEditableSelectionOffsets(8, 8); 2363 frame->setEditableSelectionOffsets(8, 8);
2363 EXPECT_TRUE(activeInputMethodController->setComposition( 2364 EXPECT_TRUE(activeInputMethodController->setComposition(
2364 "12345", emptyUnderlines, 8, 13)); 2365 "12345", emptyUnderlines, 8, 13));
2365 EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition()); 2366 EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition());
2366 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); 2367 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
2367 EXPECT_FALSE(frame->frame()->selection().isHandleVisible()); 2368 EXPECT_FALSE(frame->frame()->selection().isHandleVisible());
2369 EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition());
2368 2370
2369 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target)); 2371 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target));
2370 EXPECT_EQ("testword12345", 2372 EXPECT_EQ("testword12345",
2371 std::string(frame->selectionAsText().utf8().data())); 2373 std::string(frame->selectionAsText().utf8().data()));
2372 EXPECT_TRUE(frame->frame()->selection().isHandleVisible()); 2374 EXPECT_TRUE(frame->frame()->selection().isHandleVisible());
2375 EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition());
2373 2376
2374 // Check that finishComposingText(KeepSelection) does not dismiss handles. 2377 // Check that finishComposingText(KeepSelection) does not dismiss handles.
2375 activeInputMethodController->finishComposingText( 2378 activeInputMethodController->finishComposingText(
2376 WebInputMethodController::KeepSelection); 2379 WebInputMethodController::KeepSelection);
2377 EXPECT_TRUE(frame->frame()->selection().isHandleVisible()); 2380 EXPECT_TRUE(frame->frame()->selection().isHandleVisible());
2378 } 2381 }
2379 2382
2380 #if !OS(MACOSX) 2383 #if !OS(MACOSX)
2381 TEST_P(WebViewTest, TouchDoesntSelectEmptyTextarea) { 2384 TEST_P(WebViewTest, TouchDoesntSelectEmptyTextarea) {
2382 registerMockedHttpURLLoad("longpress_textarea.html"); 2385 registerMockedHttpURLLoad("longpress_textarea.html");
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
4235 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); 4238 EXPECT_EQ(expectedWidth, vwElement->offsetWidth());
4236 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); 4239 EXPECT_EQ(expectedHeight, vwElement->offsetHeight());
4237 4240
4238 webView->resize(WebSize(800, 600)); 4241 webView->resize(WebSize(800, 600));
4239 frame->printEnd(); 4242 frame->printEnd();
4240 4243
4241 EXPECT_EQ(800, vwElement->offsetWidth()); 4244 EXPECT_EQ(800, vwElement->offsetWidth());
4242 } 4245 }
4243 4246
4244 } // namespace blink 4247 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.cpp ('k') | third_party/WebKit/public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698