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

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

Issue 1804023002: Fix page zoom to be frame-centric for out-of-process frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert to use PageMsg instead of FrameMsg. Created 4 years, 8 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 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 void EnablePreferredSizeMode() { 359 void EnablePreferredSizeMode() {
360 view()->OnEnablePreferredSizeChangedMode(); 360 view()->OnEnablePreferredSizeChangedMode();
361 } 361 }
362 362
363 const gfx::Size& GetPreferredSize() { 363 const gfx::Size& GetPreferredSize() {
364 view()->CheckPreferredSize(); 364 view()->CheckPreferredSize();
365 return view()->preferred_size_; 365 return view()->preferred_size_;
366 } 366 }
367 367
368 void SetZoomLevel(double level) {
369 view()->OnSetZoomLevelForView(false, level);
370 }
371
372 private: 368 private:
373 scoped_ptr<MockKeyboard> mock_keyboard_; 369 scoped_ptr<MockKeyboard> mock_keyboard_;
374 }; 370 };
375 371
376 class DevToolsAgentTest : public RenderViewImplTest { 372 class DevToolsAgentTest : public RenderViewImplTest {
377 public: 373 public:
378 void Attach() { 374 void Attach() {
379 std::string host_id = "host_id"; 375 std::string host_id = "host_id";
380 agent()->OnAttach(host_id, 17); 376 agent()->OnAttach(host_id, 17);
381 } 377 }
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 2090
2095 TEST_F(RenderViewImplTest, PreferredSizeZoomed) { 2091 TEST_F(RenderViewImplTest, PreferredSizeZoomed) {
2096 LoadHTML("<body style='margin:0;'><div style='display:inline-block; " 2092 LoadHTML("<body style='margin:0;'><div style='display:inline-block; "
2097 "width:400px; height:400px;'/></body>"); 2093 "width:400px; height:400px;'/></body>");
2098 view()->webview()->mainFrame()->setCanHaveScrollbars(false); 2094 view()->webview()->mainFrame()->setCanHaveScrollbars(false);
2099 EnablePreferredSizeMode(); 2095 EnablePreferredSizeMode();
2100 2096
2101 gfx::Size size = GetPreferredSize(); 2097 gfx::Size size = GetPreferredSize();
2102 EXPECT_EQ(gfx::Size(400, 400), size); 2098 EXPECT_EQ(gfx::Size(400, 400), size);
2103 2099
2104 SetZoomLevel(ZoomFactorToZoomLevel(2.0)); 2100 double zoom_level = ZoomFactorToZoomLevel(2.0);
2101 // We must call webview()->setZoomLevel() separately, since SetZoomLevel()
2102 // now just notifies RenderViewObservers.
2103 view()->webview()->setZoomLevel(zoom_level);
alexmos 2016/04/07 23:48:08 Is this change still necessary? You've reverted S
wjmaclean 2016/04/08 20:13:29 Done.
2104
2105 size = GetPreferredSize(); 2105 size = GetPreferredSize();
2106 EXPECT_EQ(gfx::Size(800, 800), size); 2106 EXPECT_EQ(gfx::Size(800, 800), size);
2107 } 2107 }
2108 2108
2109 // Ensure the RenderViewImpl history list is properly updated when starting a 2109 // Ensure the RenderViewImpl history list is properly updated when starting a
2110 // new browser-initiated navigation. 2110 // new browser-initiated navigation.
2111 TEST_F(RenderViewImplTest, HistoryIsProperlyUpdatedOnNavigation) { 2111 TEST_F(RenderViewImplTest, HistoryIsProperlyUpdatedOnNavigation) {
2112 EXPECT_EQ(0, view()->historyBackListCount()); 2112 EXPECT_EQ(0, view()->historyBackListCount());
2113 EXPECT_EQ(0, view()->historyBackListCount() + 2113 EXPECT_EQ(0, view()->historyBackListCount() +
2114 view()->historyForwardListCount() + 1); 2114 view()->historyForwardListCount() + 1);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 FROM_HERE, 2348 FROM_HERE,
2349 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2349 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2350 ExecuteJavaScriptForTests("debugger;"); 2350 ExecuteJavaScriptForTests("debugger;");
2351 2351
2352 // CloseWhilePaused should resume execution and continue here. 2352 // CloseWhilePaused should resume execution and continue here.
2353 EXPECT_FALSE(IsPaused()); 2353 EXPECT_FALSE(IsPaused());
2354 Detach(); 2354 Detach();
2355 } 2355 }
2356 2356
2357 } // namespace content 2357 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698