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 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 if (is_surrogate_pair_empty_rect[i]) { | 1581 if (is_surrogate_pair_empty_rect[i]) { |
1582 EXPECT_EQ(0, bounds[i].width()); | 1582 EXPECT_EQ(0, bounds[i].width()); |
1583 } else { | 1583 } else { |
1584 EXPECT_LT(0, bounds[i].width()); | 1584 EXPECT_LT(0, bounds[i].width()); |
1585 } | 1585 } |
1586 } | 1586 } |
1587 view()->OnImeCommitText(empty_string, gfx::Range::InvalidRange(), 0); | 1587 view()->OnImeCommitText(empty_string, gfx::Range::InvalidRange(), 0); |
1588 } | 1588 } |
1589 #endif | 1589 #endif |
1590 | 1590 |
1591 TEST_F(RenderViewImplTest, ZoomLimit) { | |
1592 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | |
1593 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | |
1594 | |
1595 // Verifies navigation to a URL with preset zoom level indeed sets the level. | |
1596 // Regression test for http://crbug.com/139559, where the level was not | |
1597 // properly set when it is out of the default zoom limits of WebView. | |
1598 CommonNavigationParams common_params; | |
1599 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | |
1600 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); | |
1601 frame()->Navigate(common_params, StartNavigationParams(), | |
1602 RequestNavigationParams()); | |
1603 ProcessPendingMessages(); | |
1604 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | |
1605 | |
1606 // It should work even when the zoom limit is temporarily changed in the page. | |
1607 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | |
1608 ZoomFactorToZoomLevel(1.0)); | |
1609 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | |
1610 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); | |
1611 frame()->Navigate(common_params, StartNavigationParams(), | |
1612 RequestNavigationParams()); | |
1613 ProcessPendingMessages(); | |
1614 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | |
1615 } | |
1616 | |
1617 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1591 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
1618 // Load an HTML page consisting of an input field. | 1592 // Load an HTML page consisting of an input field. |
1619 LoadHTML("<html>" | 1593 LoadHTML("<html>" |
1620 "<head>" | 1594 "<head>" |
1621 "</head>" | 1595 "</head>" |
1622 "<body>" | 1596 "<body>" |
1623 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1597 "<input id=\"test1\" value=\"some test text hello\"></input>" |
1624 "</body>" | 1598 "</body>" |
1625 "</html>"); | 1599 "</html>"); |
1626 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1600 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 ExpectPauseAndResume(3); | 2512 ExpectPauseAndResume(3); |
2539 blink::WebScriptSource source2( | 2513 blink::WebScriptSource source2( |
2540 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2514 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2541 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2515 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
2542 | 2516 |
2543 EXPECT_FALSE(IsPaused()); | 2517 EXPECT_FALSE(IsPaused()); |
2544 Detach(); | 2518 Detach(); |
2545 } | 2519 } |
2546 | 2520 |
2547 } // namespace content | 2521 } // namespace content |
OLD | NEW |