Chromium Code Reviews| 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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1721 // It should work even when the zoom limit is temporarily changed in the page. | 1721 // It should work even when the zoom limit is temporarily changed in the page. |
| 1722 view()->GetWebView()->zoomLimitsChanged( | 1722 view()->GetWebView()->zoomLimitsChanged( |
| 1723 WebKit::WebView::zoomFactorToZoomLevel(1.0), | 1723 WebKit::WebView::zoomFactorToZoomLevel(1.0), |
| 1724 WebKit::WebView::zoomFactorToZoomLevel(1.0)); | 1724 WebKit::WebView::zoomFactorToZoomLevel(1.0)); |
| 1725 params.url = GURL("data:text/html,max_zoomlimit_test"); | 1725 params.url = GURL("data:text/html,max_zoomlimit_test"); |
| 1726 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel); | 1726 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel); |
| 1727 view()->OnNavigate(params); | 1727 view()->OnNavigate(params); |
| 1728 ProcessPendingMessages(); | 1728 ProcessPendingMessages(); |
| 1729 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | 1729 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); |
| 1730 } | 1730 } |
| 1731 | |
|
rniwa-cr
2012/08/23 17:46:26
Why didn't we add these tests in webkit side?
olilan
2012/08/24 09:30:49
Equivalent tests have been added on the webkit sid
| |
| 1732 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | |
| 1733 // Load an HTML page consisting of an input field. | |
| 1734 LoadHTML("<html>" | |
| 1735 "<head>" | |
| 1736 "</head>" | |
| 1737 "<body>" | |
| 1738 "<input id=\"test1\" value=\"some test text hello\"></input>" | |
| 1739 "</body>" | |
| 1740 "</html>"); | |
| 1741 ExecuteJavaScript("document.getElementById('test1').focus();"); | |
| 1742 view()->OnSetEditableSelectionOffsets(4, 8); | |
| 1743 const std::vector<WebKit::WebCompositionUnderline> empty_underline; | |
| 1744 view()->OnSetCompositionFromExistingText(7,10, empty_underline); | |
| 1745 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); | |
| 1746 EXPECT_EQ(4, info.selectionStart); | |
| 1747 EXPECT_EQ(8, info.selectionEnd); | |
| 1748 EXPECT_EQ(7, info.compositionStart); | |
| 1749 EXPECT_EQ(10, info.compositionEnd); | |
| 1750 view()->OnUnselect(); | |
| 1751 info = view()->webview()->textInputInfo(); | |
| 1752 EXPECT_EQ(0, info.selectionStart); | |
| 1753 EXPECT_EQ(0, info.selectionEnd); | |
| 1754 } | |
| 1755 | |
| 1756 TEST_F(RenderViewImplTest, OnReplaceAll) { | |
| 1757 // Load an HTML page consisting of an input field. | |
| 1758 LoadHTML("<html>" | |
| 1759 "<head>" | |
| 1760 "</head>" | |
| 1761 "<body>" | |
| 1762 "<input id=\"test1\" value=\"some test text hello\"></input>" | |
| 1763 "</body>" | |
| 1764 "</html>"); | |
| 1765 ExecuteJavaScript("document.getElementById('test1').focus();"); | |
| 1766 view()->OnReplaceAll(UTF8ToUTF16("replacement words")); | |
| 1767 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); | |
| 1768 EXPECT_EQ("replacement words", info.value); | |
| 1769 } | |
| 1770 | |
| 1771 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { | |
| 1772 // Load an HTML page consisting of an input field. | |
| 1773 LoadHTML("<html>" | |
| 1774 "<head>" | |
| 1775 "</head>" | |
| 1776 "<body>" | |
| 1777 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" | |
| 1778 "</body>" | |
| 1779 "</html>"); | |
| 1780 ExecuteJavaScript("document.getElementById('test1').focus();"); | |
| 1781 view()->OnSetEditableSelectionOffsets(10, 10); | |
| 1782 view()->OnExtendSelectionAndDelete(3, 4); | |
| 1783 WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); | |
| 1784 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | |
| 1785 EXPECT_EQ(7, info.selectionStart); | |
| 1786 EXPECT_EQ(7, info.selectionEnd); | |
| 1787 view()->OnSetEditableSelectionOffsets(4, 8); | |
| 1788 view()->OnExtendSelectionAndDelete(2, 5); | |
| 1789 info = view()->webview()->textInputInfo(); | |
| 1790 EXPECT_EQ("abuvwxyz", info.value); | |
| 1791 EXPECT_EQ(2, info.selectionStart); | |
| 1792 EXPECT_EQ(2, info.selectionEnd); | |
| 1793 } | |
| OLD | NEW |