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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 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
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | content/shell/browser/shell.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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 ViewMsg_Resize::Read(msg, &params); 1462 ViewMsg_Resize::Read(msg, &params);
1463 EXPECT_EQ("100x100", std::get<0>(params).new_size.ToString()); // dip size 1463 EXPECT_EQ("100x100", std::get<0>(params).new_size.ToString()); // dip size
1464 EXPECT_EQ( 1464 EXPECT_EQ(
1465 "100x100", 1465 "100x100",
1466 std::get<0>(params).physical_backing_size.ToString()); // backing size 1466 std::get<0>(params).physical_backing_size.ToString()); // backing size
1467 } 1467 }
1468 1468
1469 widget_host_->ResetSizeAndRepaintPendingFlags(); 1469 widget_host_->ResetSizeAndRepaintPendingFlags();
1470 sink_->ClearMessages(); 1470 sink_->ClearMessages();
1471 1471
1472 aura_test_helper_->test_screen()->SetDeviceScaleFactor(2.0f); 1472 aura_test_helper_->test_screen()->SetDeviceScaleFactorForTest(2.0f);
1473 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString()); 1473 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString());
1474 // Extra ScreenInfoChanged message for |parent_view_|. 1474 // Extra ScreenInfoChanged message for |parent_view_|.
1475 EXPECT_EQ(0u, sink_->message_count()); 1475 EXPECT_EQ(1u, sink_->message_count());
1476 auto view_delegate = static_cast<MockRenderWidgetHostDelegate*>( 1476 auto view_delegate = static_cast<MockRenderWidgetHostDelegate*>(
1477 static_cast<RenderWidgetHostImpl*>(view_->GetRenderWidgetHost()) 1477 static_cast<RenderWidgetHostImpl*>(view_->GetRenderWidgetHost())
1478 ->delegate()); 1478 ->delegate());
1479 EXPECT_EQ(2.0f, view_delegate->get_last_device_scale_factor()); 1479 EXPECT_EQ(2.0f, view_delegate->get_last_device_scale_factor());
1480 1480
1481 widget_host_->ResetSizeAndRepaintPendingFlags(); 1481 widget_host_->ResetSizeAndRepaintPendingFlags();
1482 sink_->ClearMessages(); 1482 sink_->ClearMessages();
1483 1483
1484 aura_test_helper_->test_screen()->SetDeviceScaleFactor(1.0f); 1484 aura_test_helper_->test_screen()->SetDeviceScaleFactorForTest(1.0f);
1485 // Extra ScreenInfoChanged message for |parent_view_|. 1485 // Extra ScreenInfoChanged message for |parent_view_|.
1486 EXPECT_EQ(0u, sink_->message_count()); 1486 EXPECT_EQ(1u, sink_->message_count());
1487 EXPECT_EQ(1.0f, view_delegate->get_last_device_scale_factor()); 1487 EXPECT_EQ(1.0f, view_delegate->get_last_device_scale_factor());
1488 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); 1488 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString());
1489 } 1489 }
1490 1490
1491 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched 1491 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched
1492 // to the renderer at the correct times. 1492 // to the renderer at the correct times.
1493 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) { 1493 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) {
1494 view_->InitAsChild(nullptr); 1494 view_->InitAsChild(nullptr);
1495 aura::client::ParentWindowWithContext( 1495 aura::client::ParentWindowWithContext(
1496 view_->GetNativeView(), 1496 view_->GetNativeView(),
(...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 4570
4571 // Retrieve the selected text from clipboard and verify it is as expected. 4571 // Retrieve the selected text from clipboard and verify it is as expected.
4572 base::string16 result_text; 4572 base::string16 result_text;
4573 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4573 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4574 EXPECT_EQ(expected_text, result_text); 4574 EXPECT_EQ(expected_text, result_text);
4575 } 4575 }
4576 } 4576 }
4577 #endif 4577 #endif
4578 4578
4579 } // namespace content 4579 } // namespace content
OLDNEW
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | content/shell/browser/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698