| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "content/browser/compositor/software_output_device_ozone.h" | 8 #include "content/browser/compositor/software_output_device_ozone.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/skia/include/core/SkDevice.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkSurface.h" | |
| 12 #include "ui/compositor/compositor.h" | 11 #include "ui/compositor/compositor.h" |
| 13 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
| 14 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 15 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
| 16 #include "ui/gfx/vsync_provider.h" | 15 #include "ui/gfx/vsync_provider.h" |
| 17 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/ozone/public/ozone_platform.h" | 17 #include "ui/ozone/public/ozone_platform.h" |
| 19 #include "ui/ozone/public/surface_ozone_canvas.h" | 18 #include "ui/ozone/public/surface_ozone_canvas.h" |
| 20 #include "ui/platform_window/platform_window.h" | 19 #include "ui/platform_window/platform_window.h" |
| 21 #include "ui/platform_window/platform_window_delegate.h" | 20 #include "ui/platform_window/platform_window_delegate.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SoftwareOutputDeviceOzoneTest::SetUp(); | 117 SoftwareOutputDeviceOzoneTest::SetUp(); |
| 119 } | 118 } |
| 120 | 119 |
| 121 TEST_F(SoftwareOutputDeviceOzoneTest, CheckCorrectResizeBehavior) { | 120 TEST_F(SoftwareOutputDeviceOzoneTest, CheckCorrectResizeBehavior) { |
| 122 gfx::Rect damage(0, 0, 100, 100); | 121 gfx::Rect damage(0, 0, 100, 100); |
| 123 gfx::Size size(200, 100); | 122 gfx::Size size(200, 100); |
| 124 // Reduce size. | 123 // Reduce size. |
| 125 output_device_->Resize(size, 1.f); | 124 output_device_->Resize(size, 1.f); |
| 126 | 125 |
| 127 SkCanvas* canvas = output_device_->BeginPaint(damage); | 126 SkCanvas* canvas = output_device_->BeginPaint(damage); |
| 128 gfx::Size canvas_size(canvas->getDeviceSize().width(), | 127 gfx::Size canvas_size(canvas->getBaseLayerSize().width(), |
| 129 canvas->getDeviceSize().height()); | 128 canvas->getBaseLayerSize().height()); |
| 130 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 129 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
| 131 | 130 |
| 132 size.SetSize(1000, 500); | 131 size.SetSize(1000, 500); |
| 133 // Increase size. | 132 // Increase size. |
| 134 output_device_->Resize(size, 1.f); | 133 output_device_->Resize(size, 1.f); |
| 135 | 134 |
| 136 canvas = output_device_->BeginPaint(damage); | 135 canvas = output_device_->BeginPaint(damage); |
| 137 canvas_size.SetSize(canvas->getDeviceSize().width(), | 136 canvas_size.SetSize(canvas->getBaseLayerSize().width(), |
| 138 canvas->getDeviceSize().height()); | 137 canvas->getBaseLayerSize().height()); |
| 139 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 138 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
| 140 | 139 |
| 141 } | 140 } |
| 142 | 141 |
| OLD | NEW |