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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 EXPECT_EQ(0, info.selectionEnd); | 1663 EXPECT_EQ(0, info.selectionEnd); |
1664 | 1664 |
1665 frame()->DeleteSurroundingText(10, 10); | 1665 frame()->DeleteSurroundingText(10, 10); |
1666 info = controller->textInputInfo(); | 1666 info = controller->textInputInfo(); |
1667 EXPECT_EQ("", info.value); | 1667 EXPECT_EQ("", info.value); |
1668 | 1668 |
1669 EXPECT_EQ(0, info.selectionStart); | 1669 EXPECT_EQ(0, info.selectionStart); |
1670 EXPECT_EQ(0, info.selectionEnd); | 1670 EXPECT_EQ(0, info.selectionEnd); |
1671 } | 1671 } |
1672 | 1672 |
| 1673 TEST_F(RenderViewImplTest, OnDeleteSurroundingTextInCodePoints) { |
| 1674 // Load an HTML page consisting of an input field. |
| 1675 LoadHTML( |
| 1676 // "ab" + trophy + space + "cdef" + trophy + space + "gh". |
| 1677 "<input id=\"test1\" value=\"ab🏆 cdef🏆 gh\">"); |
| 1678 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| 1679 |
| 1680 frame()->SetEditableSelectionOffsets(4, 4); |
| 1681 frame()->DeleteSurroundingTextInCodePoints(2, 2); |
| 1682 blink::WebInputMethodController* controller = |
| 1683 frame()->GetWebFrame()->inputMethodController(); |
| 1684 blink::WebTextInputInfo info = controller->textInputInfo(); |
| 1685 // "a" + "def" + trophy + space + "gh". |
| 1686 EXPECT_EQ(WebString::fromUTF8("adef\xF0\x9F\x8F\x86 gh"), info.value); |
| 1687 EXPECT_EQ(1, info.selectionStart); |
| 1688 EXPECT_EQ(1, info.selectionEnd); |
| 1689 |
| 1690 frame()->SetEditableSelectionOffsets(1, 3); |
| 1691 frame()->DeleteSurroundingTextInCodePoints(1, 4); |
| 1692 info = controller->textInputInfo(); |
| 1693 EXPECT_EQ("deh", info.value); |
| 1694 EXPECT_EQ(0, info.selectionStart); |
| 1695 EXPECT_EQ(2, info.selectionEnd); |
| 1696 } |
| 1697 |
1673 // Test that the navigating specific frames works correctly. | 1698 // Test that the navigating specific frames works correctly. |
1674 TEST_F(RenderViewImplTest, NavigateSubframe) { | 1699 TEST_F(RenderViewImplTest, NavigateSubframe) { |
1675 // Load page A. | 1700 // Load page A. |
1676 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 1701 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
1677 | 1702 |
1678 // Navigate the frame only. | 1703 // Navigate the frame only. |
1679 CommonNavigationParams common_params; | 1704 CommonNavigationParams common_params; |
1680 RequestNavigationParams request_params; | 1705 RequestNavigationParams request_params; |
1681 common_params.url = GURL("data:text/html,world"); | 1706 common_params.url = GURL("data:text/html,world"); |
1682 common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; | 1707 common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 ExpectPauseAndResume(3); | 2589 ExpectPauseAndResume(3); |
2565 blink::WebScriptSource source2( | 2590 blink::WebScriptSource source2( |
2566 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2591 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2567 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1); | 2592 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1); |
2568 | 2593 |
2569 EXPECT_FALSE(IsPaused()); | 2594 EXPECT_FALSE(IsPaused()); |
2570 Detach(); | 2595 Detach(); |
2571 } | 2596 } |
2572 | 2597 |
2573 } // namespace content | 2598 } // namespace content |
OLD | NEW |