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

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

Issue 1455143004: Use the window coordinate for the autofill bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years 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
« no previous file with comments | « content/public/renderer/render_view.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 360
361 private: 361 private:
362 DevToolsAgent* agent() { 362 DevToolsAgent* agent() {
363 return frame()->devtools_agent(); 363 return frame()->devtools_agent();
364 } 364 }
365 }; 365 };
366 366
367 class RenderViewImplBlinkSettingsTest : public RenderViewImplTest { 367 class RenderViewImplBlinkSettingsTest : public RenderViewImplTest {
368 public: 368 public:
369 void DoSetUp() { 369 virtual void DoSetUp() {
370 RenderViewImplTest::SetUp(); 370 RenderViewImplTest::SetUp();
371 } 371 }
372 372
373 blink::WebSettings* settings() { 373 blink::WebSettings* settings() {
374 return view()->webview()->settings(); 374 return view()->webview()->settings();
375 } 375 }
376 376
377 protected: 377 protected:
378 // Blink settings may be specified on the command line, which must 378 // Blink settings may be specified on the command line, which must
379 // be configured before RenderViewImplTest::SetUp runs. Thus we make 379 // be configured before RenderViewImplTest::SetUp runs. Thus we make
380 // SetUp() a no-op, and expose RenderViewImplTest::SetUp() via 380 // SetUp() a no-op, and expose RenderViewImplTest::SetUp() via
381 // DoSetUp(), to allow tests to perform command line modifications 381 // DoSetUp(), to allow tests to perform command line modifications
382 // before RenderViewImplTest::SetUp is run. Each test must invoke 382 // before RenderViewImplTest::SetUp is run. Each test must invoke
383 // DoSetUp manually once pre-SetUp configuration is complete. 383 // DoSetUp manually once pre-SetUp configuration is complete.
384 void SetUp() override {} 384 void SetUp() override {}
385 }; 385 };
386 386
387 class RenderViewImplScaleFactorTest : public RenderViewImplBlinkSettingsTest {
388 public:
389 void DoSetUp() override {
390 RenderViewImplBlinkSettingsTest::DoSetUp();
391
392 ViewMsg_Resize_Params params;
393 params.screen_info.deviceScaleFactor = 2.f;
394 params.new_size = gfx::Size(100, 100);
395 params.physical_backing_size = gfx::Size(200, 200);
396 params.visible_viewport_size = params.new_size;
397 params.needs_resize_ack = false;
398 view()->OnResize(params);
399 ASSERT_EQ(2.f, view()->device_scale_factor_);
400 }
401 };
402
387 // Ensure that the main RenderFrame is deleted and cleared from the RenderView 403 // Ensure that the main RenderFrame is deleted and cleared from the RenderView
388 // after closing it. 404 // after closing it.
389 TEST_F(RenderViewImplTest, RenderFrameClearedAfterClose) { 405 TEST_F(RenderViewImplTest, RenderFrameClearedAfterClose) {
390 // Create a new main frame RenderFrame so that we don't interfere with the 406 // Create a new main frame RenderFrame so that we don't interfere with the
391 // shutdown of frame() in RenderViewTest.TearDown. 407 // shutdown of frame() in RenderViewTest.TearDown.
392 blink::WebURLRequest popup_request(GURL("http://foo.com")); 408 blink::WebURLRequest popup_request(GURL("http://foo.com"));
393 blink::WebView* new_web_view = view()->createView( 409 blink::WebView* new_web_view = view()->createView(
394 GetMainFrame(), popup_request, blink::WebWindowFeatures(), "foo", 410 GetMainFrame(), popup_request, blink::WebWindowFeatures(), "foo",
395 blink::WebNavigationPolicyNewForegroundTab, false); 411 blink::WebNavigationPolicyNewForegroundTab, false);
396 RenderViewImpl* new_view = RenderViewImpl::FromWebView(new_web_view); 412 RenderViewImpl* new_view = RenderViewImpl::FromWebView(new_web_view);
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 2480
2465 TEST_F(RenderViewImplBlinkSettingsTest, Negative) { 2481 TEST_F(RenderViewImplBlinkSettingsTest, Negative) {
2466 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 2482 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
2467 switches::kBlinkSettings, 2483 switches::kBlinkSettings,
2468 "multiTargetTapNotificationEnabled=false,viewportEnabled=true"); 2484 "multiTargetTapNotificationEnabled=false,viewportEnabled=true");
2469 DoSetUp(); 2485 DoSetUp();
2470 EXPECT_FALSE(settings()->multiTargetTapNotificationEnabled()); 2486 EXPECT_FALSE(settings()->multiTargetTapNotificationEnabled());
2471 EXPECT_TRUE(settings()->viewportEnabled()); 2487 EXPECT_TRUE(settings()->viewportEnabled());
2472 } 2488 }
2473 2489
2490 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithoutZoomForDSF) {
2491 DoSetUp();
2492 blink::WebRect rect(20, 10, 200, 100);
2493 view()->convertViewportToWindow(&rect);
2494 EXPECT_EQ(20, rect.x);
2495 EXPECT_EQ(10, rect.y);
2496 EXPECT_EQ(200, rect.width);
2497 EXPECT_EQ(100, rect.height);
2498 }
2499
2500 TEST_F(RenderViewImplScaleFactorTest, ConverViewportToWindowWithZoomForDSF) {
2501 base::CommandLine::ForCurrentProcess()->AppendSwitch(
2502 switches::kEnableUseZoomForDSF);
2503 DoSetUp();
2504
2505 blink::WebRect rect(20, 10, 200, 100);
2506 view()->convertViewportToWindow(&rect);
2507 EXPECT_EQ(10, rect.x);
2508 EXPECT_EQ(5, rect.y);
2509 EXPECT_EQ(100, rect.width);
2510 EXPECT_EQ(50, rect.height);
2511 }
2512
2474 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) { 2513 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) {
2475 Attach(); 2514 Attach();
2476 EXPECT_FALSE(IsPaused()); 2515 EXPECT_FALSE(IsPaused());
2477 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}"); 2516 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}");
2478 2517
2479 // Executing javascript will pause the thread and create nested message loop. 2518 // Executing javascript will pause the thread and create nested message loop.
2480 // Posting task simulates message coming from browser. 2519 // Posting task simulates message coming from browser.
2481 base::ThreadTaskRunnerHandle::Get()->PostTask( 2520 base::ThreadTaskRunnerHandle::Get()->PostTask(
2482 FROM_HERE, 2521 FROM_HERE,
2483 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2522 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2484 ExecuteJavaScriptForTests("debugger;"); 2523 ExecuteJavaScriptForTests("debugger;");
2485 2524
2486 // CloseWhilePaused should resume execution and continue here. 2525 // CloseWhilePaused should resume execution and continue here.
2487 EXPECT_FALSE(IsPaused()); 2526 EXPECT_FALSE(IsPaused());
2488 Detach(); 2527 Detach();
2489 } 2528 }
2490 2529
2491 } // namespace content 2530 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/render_view.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698