OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1659 EXPECT_EQ(0, info.selectionEnd); | 1659 EXPECT_EQ(0, info.selectionEnd); |
1660 | 1660 |
1661 frame()->DeleteSurroundingText(10, 10); | 1661 frame()->DeleteSurroundingText(10, 10); |
1662 info = view()->webview()->textInputInfo(); | 1662 info = view()->webview()->textInputInfo(); |
1663 EXPECT_EQ("", info.value); | 1663 EXPECT_EQ("", info.value); |
1664 | 1664 |
1665 EXPECT_EQ(0, info.selectionStart); | 1665 EXPECT_EQ(0, info.selectionStart); |
1666 EXPECT_EQ(0, info.selectionEnd); | 1666 EXPECT_EQ(0, info.selectionEnd); |
1667 } | 1667 } |
1668 | 1668 |
1669 TEST_F(RenderViewImplTest, OnDeleteSurroundingTextInCodePoints) { | |
1670 // Load an HTML page consisting of an input field. | |
1671 LoadHTML( | |
1672 "<html>" | |
1673 "<head>" | |
1674 "</head>" | |
1675 "<body>" | |
1676 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" | |
Changwan Ryu
2017/01/11 02:00:27
please use an example that has a surrogate pair.
yabinh
2017/01/24 11:39:56
Done.
| |
1677 "</body>" | |
1678 "</html>"); | |
1679 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | |
1680 | |
1681 frame()->SetEditableSelectionOffsets(10, 10); | |
1682 frame()->DeleteSurroundingTextInCodePoints(3, 4); | |
1683 blink::WebTextInputInfo info = view()->webview()->textInputInfo(); | |
1684 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | |
1685 EXPECT_EQ(7, info.selectionStart); | |
1686 EXPECT_EQ(7, info.selectionEnd); | |
1687 | |
1688 frame()->SetEditableSelectionOffsets(4, 8); | |
1689 frame()->DeleteSurroundingTextInCodePoints(2, 5); | |
1690 info = view()->webview()->textInputInfo(); | |
1691 EXPECT_EQ("abefgouvwxyz", info.value); | |
1692 EXPECT_EQ(2, info.selectionStart); | |
1693 EXPECT_EQ(6, info.selectionEnd); | |
1694 | |
1695 frame()->SetEditableSelectionOffsets(5, 5); | |
1696 frame()->DeleteSurroundingTextInCodePoints(10, 0); | |
1697 info = view()->webview()->textInputInfo(); | |
1698 EXPECT_EQ("ouvwxyz", info.value); | |
1699 EXPECT_EQ(0, info.selectionStart); | |
1700 EXPECT_EQ(0, info.selectionEnd); | |
1701 | |
1702 frame()->DeleteSurroundingTextInCodePoints(0, 10); | |
1703 info = view()->webview()->textInputInfo(); | |
1704 EXPECT_EQ("", info.value); | |
1705 EXPECT_EQ(0, info.selectionStart); | |
1706 EXPECT_EQ(0, info.selectionEnd); | |
1707 | |
1708 frame()->DeleteSurroundingTextInCodePoints(10, 10); | |
1709 info = view()->webview()->textInputInfo(); | |
1710 EXPECT_EQ("", info.value); | |
1711 | |
1712 EXPECT_EQ(0, info.selectionStart); | |
1713 EXPECT_EQ(0, info.selectionEnd); | |
1714 } | |
1715 | |
1669 // Test that the navigating specific frames works correctly. | 1716 // Test that the navigating specific frames works correctly. |
1670 TEST_F(RenderViewImplTest, NavigateSubframe) { | 1717 TEST_F(RenderViewImplTest, NavigateSubframe) { |
1671 // Load page A. | 1718 // Load page A. |
1672 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 1719 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
1673 | 1720 |
1674 // Navigate the frame only. | 1721 // Navigate the frame only. |
1675 CommonNavigationParams common_params; | 1722 CommonNavigationParams common_params; |
1676 RequestNavigationParams request_params; | 1723 RequestNavigationParams request_params; |
1677 common_params.url = GURL("data:text/html,world"); | 1724 common_params.url = GURL("data:text/html,world"); |
1678 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1725 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2554 ExpectPauseAndResume(3); | 2601 ExpectPauseAndResume(3); |
2555 blink::WebScriptSource source2( | 2602 blink::WebScriptSource source2( |
2556 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2603 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2557 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2604 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
2558 | 2605 |
2559 EXPECT_FALSE(IsPaused()); | 2606 EXPECT_FALSE(IsPaused()); |
2560 Detach(); | 2607 Detach(); |
2561 } | 2608 } |
2562 | 2609 |
2563 } // namespace content | 2610 } // namespace content |
OLD | NEW |