| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/snapshot/snapshot.h" | 5 #include "ui/snapshot/snapshot.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Snapshot always captures the physical pixels. | 237 // Snapshot always captures the physical pixels. |
| 238 gfx::SizeF snapshot_size(test_bounds.size()); | 238 gfx::SizeF snapshot_size(test_bounds.size()); |
| 239 | 239 |
| 240 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 240 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
| 241 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 241 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
| 242 snapshot.Size().ToString()); | 242 snapshot.Size().ToString()); |
| 243 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); | 243 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 TEST_F(SnapshotAuraTest, DeviceScaleFactor) { | 246 TEST_F(SnapshotAuraTest, DeviceScaleFactor) { |
| 247 test_screen()->SetDeviceScaleFactor(2.0f); | 247 test_screen()->SetDeviceScaleFactorForTest(2.0f); |
| 248 | 248 |
| 249 gfx::Rect test_bounds(100, 100, 150, 100); | 249 gfx::Rect test_bounds(100, 100, 150, 100); |
| 250 SetupTestWindow(test_bounds); | 250 SetupTestWindow(test_bounds); |
| 251 WaitForDraw(); | 251 WaitForDraw(); |
| 252 | 252 |
| 253 // Snapshot always captures the physical pixels. | 253 // Snapshot always captures the physical pixels. |
| 254 gfx::SizeF snapshot_size(test_bounds.size()); | 254 gfx::SizeF snapshot_size(test_bounds.size()); |
| 255 snapshot_size.Scale(2.0f); | 255 snapshot_size.Scale(2.0f); |
| 256 | 256 |
| 257 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 257 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 272 // Snapshot always captures the physical pixels. | 272 // Snapshot always captures the physical pixels. |
| 273 gfx::SizeF snapshot_size(test_bounds.size()); | 273 gfx::SizeF snapshot_size(test_bounds.size()); |
| 274 | 274 |
| 275 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 275 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
| 276 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 276 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
| 277 snapshot.Size().ToString()); | 277 snapshot.Size().ToString()); |
| 278 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); | 278 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); |
| 279 } | 279 } |
| 280 | 280 |
| 281 TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) { | 281 TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) { |
| 282 test_screen()->SetDeviceScaleFactor(2.0f); | 282 test_screen()->SetDeviceScaleFactorForTest(2.0f); |
| 283 const float kUIScale = 1.25f; | 283 const float kUIScale = 1.25f; |
| 284 test_screen()->SetUIScale(kUIScale); | 284 test_screen()->SetUIScale(kUIScale); |
| 285 test_screen()->SetDisplayRotation(display::Display::ROTATE_90); | 285 test_screen()->SetDisplayRotation(display::Display::ROTATE_90); |
| 286 | 286 |
| 287 gfx::Rect test_bounds(20, 30, 150, 100); | 287 gfx::Rect test_bounds(20, 30, 150, 100); |
| 288 SetupTestWindow(test_bounds); | 288 SetupTestWindow(test_bounds); |
| 289 WaitForDraw(); | 289 WaitForDraw(); |
| 290 | 290 |
| 291 // Snapshot always captures the physical pixels. | 291 // Snapshot always captures the physical pixels. |
| 292 gfx::SizeF snapshot_size(test_bounds.size()); | 292 gfx::SizeF snapshot_size(test_bounds.size()); |
| 293 snapshot_size.Scale(2.0f); | 293 snapshot_size.Scale(2.0f); |
| 294 | 294 |
| 295 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 295 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
| 296 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 296 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
| 297 snapshot.Size().ToString()); | 297 snapshot.Size().ToString()); |
| 298 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); | 298 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace ui | 301 } // namespace ui |
| OLD | NEW |