| 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 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 EnablePreferredSizeMode(); | 2199 EnablePreferredSizeMode(); |
| 2200 | 2200 |
| 2201 gfx::Size size = GetPreferredSize(); | 2201 gfx::Size size = GetPreferredSize(); |
| 2202 EXPECT_EQ(gfx::Size(400, 400), size); | 2202 EXPECT_EQ(gfx::Size(400, 400), size); |
| 2203 | 2203 |
| 2204 SetZoomLevel(ZoomFactorToZoomLevel(2.0)); | 2204 SetZoomLevel(ZoomFactorToZoomLevel(2.0)); |
| 2205 size = GetPreferredSize(); | 2205 size = GetPreferredSize(); |
| 2206 EXPECT_EQ(gfx::Size(800, 800), size); | 2206 EXPECT_EQ(gfx::Size(800, 800), size); |
| 2207 } | 2207 } |
| 2208 | 2208 |
| 2209 TEST_F(RenderViewImplScaleFactorTest, PreferredSizeWithScaleFactor) { |
| 2210 DoSetUp(); |
| 2211 LoadHTML("<body style='margin:0;'><div style='display:inline-block; " |
| 2212 "width:400px; height:400px;'/></body>"); |
| 2213 view()->webview()->MainFrame()->ToWebLocalFrame()->SetCanHaveScrollbars( |
| 2214 false); |
| 2215 EnablePreferredSizeMode(); |
| 2216 |
| 2217 gfx::Size size = GetPreferredSize(); |
| 2218 EXPECT_EQ(gfx::Size(400, 400), size); |
| 2219 |
| 2220 // The size is in DIP. Changing the scale factor should not change |
| 2221 // the preferred size. (Caveat: a page may apply different layout for |
| 2222 // high DPI, in which case, the size may differ.) |
| 2223 SetDeviceScaleFactor(2.f); |
| 2224 size = GetPreferredSize(); |
| 2225 EXPECT_EQ(gfx::Size(400, 400), size); |
| 2226 } |
| 2227 |
| 2209 // Ensure the RenderViewImpl history list is properly updated when starting a | 2228 // Ensure the RenderViewImpl history list is properly updated when starting a |
| 2210 // new browser-initiated navigation. | 2229 // new browser-initiated navigation. |
| 2211 TEST_F(RenderViewImplTest, HistoryIsProperlyUpdatedOnNavigation) { | 2230 TEST_F(RenderViewImplTest, HistoryIsProperlyUpdatedOnNavigation) { |
| 2212 EXPECT_EQ(0, view()->HistoryBackListCount()); | 2231 EXPECT_EQ(0, view()->HistoryBackListCount()); |
| 2213 EXPECT_EQ(0, view()->HistoryBackListCount() + | 2232 EXPECT_EQ(0, view()->HistoryBackListCount() + |
| 2214 view()->HistoryForwardListCount() + 1); | 2233 view()->HistoryForwardListCount() + 1); |
| 2215 | 2234 |
| 2216 // Receive a Navigate message with history parameters. | 2235 // Receive a Navigate message with history parameters. |
| 2217 RequestNavigationParams request_params; | 2236 RequestNavigationParams request_params; |
| 2218 request_params.current_history_list_length = 2; | 2237 request_params.current_history_list_length = 2; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 ExpectPauseAndResume(3); | 2611 ExpectPauseAndResume(3); |
| 2593 blink::WebScriptSource source2( | 2612 blink::WebScriptSource source2( |
| 2594 WebString::FromUTF8("function func2() { func1(); }; func2();")); | 2613 WebString::FromUTF8("function func2() { func1(); }; func2();")); |
| 2595 frame()->GetWebFrame()->ExecuteScriptInIsolatedWorld(17, &source2, 1); | 2614 frame()->GetWebFrame()->ExecuteScriptInIsolatedWorld(17, &source2, 1); |
| 2596 | 2615 |
| 2597 EXPECT_FALSE(IsPaused()); | 2616 EXPECT_FALSE(IsPaused()); |
| 2598 Detach(); | 2617 Detach(); |
| 2599 } | 2618 } |
| 2600 | 2619 |
| 2601 } // namespace content | 2620 } // namespace content |
| OLD | NEW |