| 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 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 EXPECT_EQ(0, bounds[i].width()); | 1597 EXPECT_EQ(0, bounds[i].width()); |
| 1598 } else { | 1598 } else { |
| 1599 EXPECT_LT(0, bounds[i].width()); | 1599 EXPECT_LT(0, bounds[i].width()); |
| 1600 } | 1600 } |
| 1601 } | 1601 } |
| 1602 view()->OnImeConfirmComposition( | 1602 view()->OnImeConfirmComposition( |
| 1603 empty_string, gfx::Range::InvalidRange(), false); | 1603 empty_string, gfx::Range::InvalidRange(), false); |
| 1604 } | 1604 } |
| 1605 #endif | 1605 #endif |
| 1606 | 1606 |
| 1607 TEST_F(RenderViewImplTest, ZoomLimit) { | |
| 1608 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | |
| 1609 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | |
| 1610 | |
| 1611 // Verifies navigation to a URL with preset zoom level indeed sets the level. | |
| 1612 // Regression test for http://crbug.com/139559, where the level was not | |
| 1613 // properly set when it is out of the default zoom limits of WebView. | |
| 1614 CommonNavigationParams common_params; | |
| 1615 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | |
| 1616 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); | |
| 1617 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1618 RequestNavigationParams()); | |
| 1619 ProcessPendingMessages(); | |
| 1620 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1621 | |
| 1622 // It should work even when the zoom limit is temporarily changed in the page. | |
| 1623 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | |
| 1624 ZoomFactorToZoomLevel(1.0)); | |
| 1625 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | |
| 1626 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); | |
| 1627 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1628 RequestNavigationParams()); | |
| 1629 ProcessPendingMessages(); | |
| 1630 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1631 } | |
| 1632 | |
| 1633 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1607 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
| 1634 // Load an HTML page consisting of an input field. | 1608 // Load an HTML page consisting of an input field. |
| 1635 LoadHTML("<html>" | 1609 LoadHTML("<html>" |
| 1636 "<head>" | 1610 "<head>" |
| 1637 "</head>" | 1611 "</head>" |
| 1638 "<body>" | 1612 "<body>" |
| 1639 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1613 "<input id=\"test1\" value=\"some test text hello\"></input>" |
| 1640 "</body>" | 1614 "</body>" |
| 1641 "</html>"); | 1615 "</html>"); |
| 1642 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1616 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 "," | 2429 "," |
| 2456 "\"functionDeclaration\":\"function foo(){ " | 2430 "\"functionDeclaration\":\"function foo(){ " |
| 2457 "Promise.resolve().then(() => " | 2431 "Promise.resolve().then(() => " |
| 2458 "console.log(239))}\"" | 2432 "console.log(239))}\"" |
| 2459 "}" | 2433 "}" |
| 2460 "}"); | 2434 "}"); |
| 2461 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); | 2435 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); |
| 2462 } | 2436 } |
| 2463 | 2437 |
| 2464 } // namespace content | 2438 } // namespace content |
| OLD | NEW |