| 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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1694   EXPECT_EQ(4, info.selectionStart); |  1694   EXPECT_EQ(4, info.selectionStart); | 
|  1695   EXPECT_EQ(8, info.selectionEnd); |  1695   EXPECT_EQ(8, info.selectionEnd); | 
|  1696   EXPECT_EQ(7, info.compositionStart); |  1696   EXPECT_EQ(7, info.compositionStart); | 
|  1697   EXPECT_EQ(10, info.compositionEnd); |  1697   EXPECT_EQ(10, info.compositionEnd); | 
|  1698   frame()->Unselect(); |  1698   frame()->Unselect(); | 
|  1699   info = view()->webview()->textInputInfo(); |  1699   info = view()->webview()->textInputInfo(); | 
|  1700   EXPECT_EQ(0, info.selectionStart); |  1700   EXPECT_EQ(0, info.selectionStart); | 
|  1701   EXPECT_EQ(0, info.selectionEnd); |  1701   EXPECT_EQ(0, info.selectionEnd); | 
|  1702 } |  1702 } | 
|  1703  |  1703  | 
|  1704  |  | 
|  1705 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { |  1704 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { | 
|  1706   // Load an HTML page consisting of an input field. |  1705   // Load an HTML page consisting of an input field. | 
|  1707   LoadHTML("<html>" |  1706   LoadHTML("<html>" | 
|  1708            "<head>" |  1707            "<head>" | 
|  1709            "</head>" |  1708            "</head>" | 
|  1710            "<body>" |  1709            "<body>" | 
|  1711            "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" |  1710            "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" | 
|  1712            "</body>" |  1711            "</body>" | 
|  1713            "</html>"); |  1712            "</html>"); | 
|  1714   ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |  1713   ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 
|  1715   frame()->SetEditableSelectionOffsets(10, 10); |  1714   frame()->SetEditableSelectionOffsets(10, 10); | 
|  1716   frame()->ExtendSelectionAndDelete(3, 4); |  1715   frame()->ExtendSelectionAndDelete(3, 4); | 
|  1717   blink::WebTextInputInfo info = view()->webview()->textInputInfo(); |  1716   blink::WebTextInputInfo info = view()->webview()->textInputInfo(); | 
|  1718   EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); |  1717   EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | 
|  1719   EXPECT_EQ(7, info.selectionStart); |  1718   EXPECT_EQ(7, info.selectionStart); | 
|  1720   EXPECT_EQ(7, info.selectionEnd); |  1719   EXPECT_EQ(7, info.selectionEnd); | 
|  1721   frame()->SetEditableSelectionOffsets(4, 8); |  1720   frame()->SetEditableSelectionOffsets(4, 8); | 
|  1722   frame()->ExtendSelectionAndDelete(2, 5); |  1721   frame()->ExtendSelectionAndDelete(2, 5); | 
|  1723   info = view()->webview()->textInputInfo(); |  1722   info = view()->webview()->textInputInfo(); | 
|  1724   EXPECT_EQ("abuvwxyz", info.value); |  1723   EXPECT_EQ("abuvwxyz", info.value); | 
|  1725   EXPECT_EQ(2, info.selectionStart); |  1724   EXPECT_EQ(2, info.selectionStart); | 
|  1726   EXPECT_EQ(2, info.selectionEnd); |  1725   EXPECT_EQ(2, info.selectionEnd); | 
|  1727 } |  1726 } | 
|  1728  |  1727  | 
 |  1728 TEST_F(RenderViewImplTest, OnDeleteSurroundingText) { | 
 |  1729   // Load an HTML page consisting of an input field. | 
 |  1730   LoadHTML( | 
 |  1731       "<html>" | 
 |  1732       "<head>" | 
 |  1733       "</head>" | 
 |  1734       "<body>" | 
 |  1735       "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" | 
 |  1736       "</body>" | 
 |  1737       "</html>"); | 
 |  1738   ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 
 |  1739  | 
 |  1740   frame()->SetEditableSelectionOffsets(10, 10); | 
 |  1741   frame()->DeleteSurroundingText(3, 4); | 
 |  1742   blink::WebTextInputInfo info = view()->webview()->textInputInfo(); | 
 |  1743   EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | 
 |  1744   EXPECT_EQ(7, info.selectionStart); | 
 |  1745   EXPECT_EQ(7, info.selectionEnd); | 
 |  1746  | 
 |  1747   frame()->SetEditableSelectionOffsets(4, 8); | 
 |  1748   frame()->DeleteSurroundingText(2, 5); | 
 |  1749   info = view()->webview()->textInputInfo(); | 
 |  1750   EXPECT_EQ("abefgouvwxyz", info.value); | 
 |  1751   EXPECT_EQ(2, info.selectionStart); | 
 |  1752   EXPECT_EQ(6, info.selectionEnd); | 
 |  1753  | 
 |  1754   frame()->SetEditableSelectionOffsets(5, 5); | 
 |  1755   frame()->DeleteSurroundingText(10, 0); | 
 |  1756   info = view()->webview()->textInputInfo(); | 
 |  1757   EXPECT_EQ("ouvwxyz", info.value); | 
 |  1758   EXPECT_EQ(0, info.selectionStart); | 
 |  1759   EXPECT_EQ(0, info.selectionEnd); | 
 |  1760  | 
 |  1761   frame()->DeleteSurroundingText(0, 10); | 
 |  1762   info = view()->webview()->textInputInfo(); | 
 |  1763   EXPECT_EQ("", info.value); | 
 |  1764   EXPECT_EQ(0, info.selectionStart); | 
 |  1765   EXPECT_EQ(0, info.selectionEnd); | 
 |  1766  | 
 |  1767   frame()->DeleteSurroundingText(10, 10); | 
 |  1768   info = view()->webview()->textInputInfo(); | 
 |  1769   EXPECT_EQ("", info.value); | 
 |  1770  | 
 |  1771   EXPECT_EQ(0, info.selectionStart); | 
 |  1772   EXPECT_EQ(0, info.selectionEnd); | 
 |  1773 } | 
 |  1774  | 
|  1729 // Test that the navigating specific frames works correctly. |  1775 // Test that the navigating specific frames works correctly. | 
|  1730 TEST_F(RenderViewImplTest, NavigateSubframe) { |  1776 TEST_F(RenderViewImplTest, NavigateSubframe) { | 
|  1731   // Load page A. |  1777   // Load page A. | 
|  1732   LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |  1778   LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 
|  1733  |  1779  | 
|  1734   // Navigate the frame only. |  1780   // Navigate the frame only. | 
|  1735   CommonNavigationParams common_params; |  1781   CommonNavigationParams common_params; | 
|  1736   RequestNavigationParams request_params; |  1782   RequestNavigationParams request_params; | 
|  1737   common_params.url = GURL("data:text/html,world"); |  1783   common_params.url = GURL("data:text/html,world"); | 
|  1738   common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |  1784   common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2502                               "," |  2548                               "," | 
|  2503                               "\"functionDeclaration\":\"function foo(){ " |  2549                               "\"functionDeclaration\":\"function foo(){ " | 
|  2504                               "Promise.resolve().then(() => " |  2550                               "Promise.resolve().then(() => " | 
|  2505                               "console.log(239))}\"" |  2551                               "console.log(239))}\"" | 
|  2506                               "}" |  2552                               "}" | 
|  2507                               "}"); |  2553                               "}"); | 
|  2508   EXPECT_EQ(1, CountNotifications("Console.messageAdded")); |  2554   EXPECT_EQ(1, CountNotifications("Console.messageAdded")); | 
|  2509 } |  2555 } | 
|  2510  |  2556  | 
|  2511 }  // namespace content |  2557 }  // namespace content | 
| OLD | NEW |