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 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1427 EXPECT_EQ(0, info.selectionStart); | 1427 EXPECT_EQ(0, info.selectionStart); |
| 1428 EXPECT_EQ(0, info.selectionEnd); | 1428 EXPECT_EQ(0, info.selectionEnd); |
| 1429 | 1429 |
| 1430 frame->deleteSurroundingText(10, 10); | 1430 frame->deleteSurroundingText(10, 10); |
| 1431 info = activeInputMethodController->textInputInfo(); | 1431 info = activeInputMethodController->textInputInfo(); |
| 1432 EXPECT_EQ("", std::string(info.value.utf8().data())); | 1432 EXPECT_EQ("", std::string(info.value.utf8().data())); |
| 1433 EXPECT_EQ(0, info.selectionStart); | 1433 EXPECT_EQ(0, info.selectionStart); |
| 1434 EXPECT_EQ(0, info.selectionEnd); | 1434 EXPECT_EQ(0, info.selectionEnd); |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 TEST_P(WebViewTest, DeleteSurroundingTextInCodePoints) { | |
|
Changwan Ryu
2017/01/25 07:30:56
I don't think that this test adds any value becaus
yabinh
2017/02/08 12:32:42
Done. Removed.
| |
| 1438 URLTestHelpers::registerMockedURLFromBaseURL( | |
| 1439 WebString::fromUTF8(m_baseURL.c_str()), | |
| 1440 WebString::fromUTF8("input_field_populated.html")); | |
| 1441 WebView* webView = m_webViewHelper.initializeAndLoad( | |
| 1442 m_baseURL + "input_field_populated.html"); | |
| 1443 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | |
| 1444 // Focus on node "sample2". | |
| 1445 webView->setInitialFocus(true); | |
| 1446 | |
| 1447 frame->setEditableSelectionOffsets(4, 4); | |
| 1448 frame->deleteSurroundingTextInCodePoints(2, 2); | |
| 1449 WebInputMethodController* activeInputMethodController = | |
| 1450 frame->inputMethodController(); | |
| 1451 WebTextInputInfo info = activeInputMethodController->textInputInfo(); | |
| 1452 // "a" + "def" + trophy + space + "gh". | |
| 1453 EXPECT_EQ(WebString::fromUTF8("adef\xF0\x9F\x8F\x86 gh"), info.value); | |
| 1454 EXPECT_EQ(1, info.selectionStart); | |
| 1455 EXPECT_EQ(1, info.selectionEnd); | |
| 1456 | |
| 1457 frame->setEditableSelectionOffsets(1, 3); | |
| 1458 frame->deleteSurroundingTextInCodePoints(1, 4); | |
| 1459 info = activeInputMethodController->textInputInfo(); | |
| 1460 EXPECT_EQ("deh", info.value); | |
| 1461 EXPECT_EQ(0, info.selectionStart); | |
| 1462 EXPECT_EQ(2, info.selectionEnd); | |
| 1463 } | |
| 1464 | |
| 1437 TEST_P(WebViewTest, SetCompositionFromExistingText) { | 1465 TEST_P(WebViewTest, SetCompositionFromExistingText) { |
| 1438 URLTestHelpers::registerMockedURLFromBaseURL( | 1466 URLTestHelpers::registerMockedURLFromBaseURL( |
| 1439 WebString::fromUTF8(m_baseURL.c_str()), | 1467 WebString::fromUTF8(m_baseURL.c_str()), |
| 1440 WebString::fromUTF8("input_field_populated.html")); | 1468 WebString::fromUTF8("input_field_populated.html")); |
| 1441 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( | 1469 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
| 1442 m_baseURL + "input_field_populated.html"); | 1470 m_baseURL + "input_field_populated.html"); |
| 1443 webView->setInitialFocus(false); | 1471 webView->setInitialFocus(false); |
| 1444 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 1472 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
| 1445 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); | 1473 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); |
| 1446 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1474 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| (...skipping 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4382 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); | 4410 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); |
| 4383 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); | 4411 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); |
| 4384 | 4412 |
| 4385 webView->resize(WebSize(800, 600)); | 4413 webView->resize(WebSize(800, 600)); |
| 4386 frame->printEnd(); | 4414 frame->printEnd(); |
| 4387 | 4415 |
| 4388 EXPECT_EQ(800, vwElement->offsetWidth()); | 4416 EXPECT_EQ(800, vwElement->offsetWidth()); |
| 4389 } | 4417 } |
| 4390 | 4418 |
| 4391 } // namespace blink | 4419 } // namespace blink |
| OLD | NEW |