| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 | 6 |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 EXPECT_EQ(4, info.selectionStart); | 1824 EXPECT_EQ(4, info.selectionStart); |
| 1825 EXPECT_EQ(8, info.selectionEnd); | 1825 EXPECT_EQ(8, info.selectionEnd); |
| 1826 EXPECT_EQ(7, info.compositionStart); | 1826 EXPECT_EQ(7, info.compositionStart); |
| 1827 EXPECT_EQ(10, info.compositionEnd); | 1827 EXPECT_EQ(10, info.compositionEnd); |
| 1828 view()->OnUnselect(); | 1828 view()->OnUnselect(); |
| 1829 info = view()->webview()->textInputInfo(); | 1829 info = view()->webview()->textInputInfo(); |
| 1830 EXPECT_EQ(0, info.selectionStart); | 1830 EXPECT_EQ(0, info.selectionStart); |
| 1831 EXPECT_EQ(0, info.selectionEnd); | 1831 EXPECT_EQ(0, info.selectionEnd); |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 TEST_F(RenderViewImplTest, OnReplaceAll) { | |
| 1835 // Load an HTML page consisting of an input field. | |
| 1836 LoadHTML("<html>" | |
| 1837 "<head>" | |
| 1838 "</head>" | |
| 1839 "<body>" | |
| 1840 "<input id=\"test1\" value=\"some test text hello\"></input>" | |
| 1841 "</body>" | |
| 1842 "</html>"); | |
| 1843 ExecuteJavaScript("document.getElementById('test1').focus();"); | |
| 1844 view()->OnReplaceAll(UTF8ToUTF16("replacement words")); | |
| 1845 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); | |
| 1846 EXPECT_EQ("replacement words", info.value); | |
| 1847 } | |
| 1848 | 1834 |
| 1849 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { | 1835 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { |
| 1850 // Load an HTML page consisting of an input field. | 1836 // Load an HTML page consisting of an input field. |
| 1851 LoadHTML("<html>" | 1837 LoadHTML("<html>" |
| 1852 "<head>" | 1838 "<head>" |
| 1853 "</head>" | 1839 "</head>" |
| 1854 "<body>" | 1840 "<body>" |
| 1855 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" | 1841 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" |
| 1856 "</body>" | 1842 "</body>" |
| 1857 "</html>"); | 1843 "</html>"); |
| 1858 ExecuteJavaScript("document.getElementById('test1').focus();"); | 1844 ExecuteJavaScript("document.getElementById('test1').focus();"); |
| 1859 view()->OnSetEditableSelectionOffsets(10, 10); | 1845 view()->OnSetEditableSelectionOffsets(10, 10); |
| 1860 view()->OnExtendSelectionAndDelete(3, 4); | 1846 view()->OnExtendSelectionAndDelete(3, 4); |
| 1861 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); | 1847 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); |
| 1862 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | 1848 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); |
| 1863 EXPECT_EQ(7, info.selectionStart); | 1849 EXPECT_EQ(7, info.selectionStart); |
| 1864 EXPECT_EQ(7, info.selectionEnd); | 1850 EXPECT_EQ(7, info.selectionEnd); |
| 1865 view()->OnSetEditableSelectionOffsets(4, 8); | 1851 view()->OnSetEditableSelectionOffsets(4, 8); |
| 1866 view()->OnExtendSelectionAndDelete(2, 5); | 1852 view()->OnExtendSelectionAndDelete(2, 5); |
| 1867 info = view()->webview()->textInputInfo(); | 1853 info = view()->webview()->textInputInfo(); |
| 1868 EXPECT_EQ("abuvwxyz", info.value); | 1854 EXPECT_EQ("abuvwxyz", info.value); |
| 1869 EXPECT_EQ(2, info.selectionStart); | 1855 EXPECT_EQ(2, info.selectionStart); |
| 1870 EXPECT_EQ(2, info.selectionEnd); | 1856 EXPECT_EQ(2, info.selectionEnd); |
| 1871 } | 1857 } |
| 1872 | 1858 |
| 1873 } // namespace content | 1859 } // namespace content |
| OLD | NEW |