Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(851)

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 EXPECT_FALSE(settings()->multiTargetTapNotificationEnabled()); 2198 EXPECT_FALSE(settings()->multiTargetTapNotificationEnabled());
2199 EXPECT_TRUE(settings()->viewportEnabled()); 2199 EXPECT_TRUE(settings()->viewportEnabled());
2200 } 2200 }
2201 2201
2202 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithoutZoomForDSF) { 2202 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithoutZoomForDSF) {
2203 DoSetUp(); 2203 DoSetUp();
2204 if (IsUseZoomForDSFEnabled()) 2204 if (IsUseZoomForDSFEnabled())
2205 return; 2205 return;
2206 SetDeviceScaleFactor(2.f); 2206 SetDeviceScaleFactor(2.f);
2207 blink::WebRect rect(20, 10, 200, 100); 2207 blink::WebRect rect(20, 10, 200, 100);
2208 view()->convertViewportToWindow(&rect); 2208 view()->GetWidget()->convertViewportToWindow(&rect);
2209 EXPECT_EQ(20, rect.x); 2209 EXPECT_EQ(20, rect.x);
2210 EXPECT_EQ(10, rect.y); 2210 EXPECT_EQ(10, rect.y);
2211 EXPECT_EQ(200, rect.width); 2211 EXPECT_EQ(200, rect.width);
2212 EXPECT_EQ(100, rect.height); 2212 EXPECT_EQ(100, rect.height);
2213 } 2213 }
2214 2214
2215 TEST_F(RenderViewImplScaleFactorTest, ScreenMetricsEmulationWithOriginalDSF1) { 2215 TEST_F(RenderViewImplScaleFactorTest, ScreenMetricsEmulationWithOriginalDSF1) {
2216 DoSetUp(); 2216 DoSetUp();
2217 SetDeviceScaleFactor(1.f); 2217 SetDeviceScaleFactor(1.f);
2218 2218
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 // Don't disable here to test that emulation is being shutdown properly. 2272 // Don't disable here to test that emulation is being shutdown properly.
2273 } 2273 }
2274 2274
2275 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithZoomForDSF) { 2275 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithZoomForDSF) {
2276 base::CommandLine::ForCurrentProcess()->AppendSwitch( 2276 base::CommandLine::ForCurrentProcess()->AppendSwitch(
2277 switches::kEnableUseZoomForDSF); 2277 switches::kEnableUseZoomForDSF);
2278 DoSetUp(); 2278 DoSetUp();
2279 SetDeviceScaleFactor(1.f); 2279 SetDeviceScaleFactor(1.f);
2280 { 2280 {
2281 blink::WebRect rect(20, 10, 200, 100); 2281 blink::WebRect rect(20, 10, 200, 100);
2282 view()->convertViewportToWindow(&rect); 2282 view()->GetWidget()->convertViewportToWindow(&rect);
2283 EXPECT_EQ(20, rect.x); 2283 EXPECT_EQ(20, rect.x);
2284 EXPECT_EQ(10, rect.y); 2284 EXPECT_EQ(10, rect.y);
2285 EXPECT_EQ(200, rect.width); 2285 EXPECT_EQ(200, rect.width);
2286 EXPECT_EQ(100, rect.height); 2286 EXPECT_EQ(100, rect.height);
2287 } 2287 }
2288 2288
2289 SetDeviceScaleFactor(2.f); 2289 SetDeviceScaleFactor(2.f);
2290 { 2290 {
2291 blink::WebRect rect(20, 10, 200, 100); 2291 blink::WebRect rect(20, 10, 200, 100);
2292 view()->convertViewportToWindow(&rect); 2292 view()->GetWidget()->convertViewportToWindow(&rect);
2293 EXPECT_EQ(10, rect.x); 2293 EXPECT_EQ(10, rect.x);
2294 EXPECT_EQ(5, rect.y); 2294 EXPECT_EQ(5, rect.y);
2295 EXPECT_EQ(100, rect.width); 2295 EXPECT_EQ(100, rect.width);
2296 EXPECT_EQ(50, rect.height); 2296 EXPECT_EQ(50, rect.height);
2297 } 2297 }
2298 } 2298 }
2299 2299
2300 #if defined(OS_MACOSX) || defined(USE_AURA) 2300 #if defined(OS_MACOSX) || defined(USE_AURA)
2301 TEST_F(RenderViewImplScaleFactorTest, 2301 TEST_F(RenderViewImplScaleFactorTest,
2302 DISABLED_GetCompositionCharacterBoundsTest) { // http://crbug.com/582016 2302 DISABLED_GetCompositionCharacterBoundsTest) { // http://crbug.com/582016
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 ExpectPauseAndResume(3); 2483 ExpectPauseAndResume(3);
2484 blink::WebScriptSource source2( 2484 blink::WebScriptSource source2(
2485 WebString::fromUTF8("function func2() { func1(); }; func2();")); 2485 WebString::fromUTF8("function func2() { func1(); }; func2();"));
2486 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); 2486 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1);
2487 2487
2488 EXPECT_FALSE(IsPaused()); 2488 EXPECT_FALSE(IsPaused());
2489 Detach(); 2489 Detach();
2490 } 2490 }
2491 2491
2492 } // namespace content 2492 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698