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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 EXPECT_EQ(0, info.selectionEnd); | 1660 EXPECT_EQ(0, info.selectionEnd); |
1661 | 1661 |
1662 frame()->DeleteSurroundingText(10, 10); | 1662 frame()->DeleteSurroundingText(10, 10); |
1663 info = controller->textInputInfo(); | 1663 info = controller->textInputInfo(); |
1664 EXPECT_EQ("", info.value); | 1664 EXPECT_EQ("", info.value); |
1665 | 1665 |
1666 EXPECT_EQ(0, info.selectionStart); | 1666 EXPECT_EQ(0, info.selectionStart); |
1667 EXPECT_EQ(0, info.selectionEnd); | 1667 EXPECT_EQ(0, info.selectionEnd); |
1668 } | 1668 } |
1669 | 1669 |
| 1670 TEST_F(RenderViewImplTest, OnDeleteSurroundingTextInCodePoints) { |
| 1671 // Load an HTML page consisting of an input field. |
| 1672 LoadHTML( |
| 1673 // "ab" + trophy + space + "cdef" + trophy + space + "gh". |
| 1674 "<input id=\"test1\" value=\"ab🏆 cdef🏆 gh\">"); |
| 1675 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| 1676 |
| 1677 frame()->SetEditableSelectionOffsets(4, 4); |
| 1678 frame()->DeleteSurroundingTextInCodePoints(2, 2); |
| 1679 blink::WebInputMethodController* controller = |
| 1680 frame()->GetWebFrame()->inputMethodController(); |
| 1681 blink::WebTextInputInfo info = controller->textInputInfo(); |
| 1682 // "a" + "def" + trophy + space + "gh". |
| 1683 EXPECT_EQ(WebString::fromUTF8("adef\xF0\x9F\x8F\x86 gh"), info.value); |
| 1684 EXPECT_EQ(1, info.selectionStart); |
| 1685 EXPECT_EQ(1, info.selectionEnd); |
| 1686 |
| 1687 frame()->SetEditableSelectionOffsets(1, 3); |
| 1688 frame()->DeleteSurroundingTextInCodePoints(1, 4); |
| 1689 info = controller->textInputInfo(); |
| 1690 EXPECT_EQ("deh", info.value); |
| 1691 EXPECT_EQ(0, info.selectionStart); |
| 1692 EXPECT_EQ(2, info.selectionEnd); |
| 1693 } |
| 1694 |
1670 // Test that the navigating specific frames works correctly. | 1695 // Test that the navigating specific frames works correctly. |
1671 TEST_F(RenderViewImplTest, NavigateSubframe) { | 1696 TEST_F(RenderViewImplTest, NavigateSubframe) { |
1672 // Load page A. | 1697 // Load page A. |
1673 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 1698 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
1674 | 1699 |
1675 // Navigate the frame only. | 1700 // Navigate the frame only. |
1676 CommonNavigationParams common_params; | 1701 CommonNavigationParams common_params; |
1677 RequestNavigationParams request_params; | 1702 RequestNavigationParams request_params; |
1678 common_params.url = GURL("data:text/html,world"); | 1703 common_params.url = GURL("data:text/html,world"); |
1679 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1704 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 ExpectPauseAndResume(3); | 2580 ExpectPauseAndResume(3); |
2556 blink::WebScriptSource source2( | 2581 blink::WebScriptSource source2( |
2557 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2582 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2558 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1); | 2583 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1); |
2559 | 2584 |
2560 EXPECT_FALSE(IsPaused()); | 2585 EXPECT_FALSE(IsPaused()); |
2561 Detach(); | 2586 Detach(); |
2562 } | 2587 } |
2563 | 2588 |
2564 } // namespace content | 2589 } // namespace content |
OLD | NEW |