| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "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 "cc/output/software_frame_data.h" | 7 #include "cc/output/software_frame_data.h" |
| 8 #include "content/browser/aura/software_output_device_ozone.h" | 8 #include "content/browser/aura/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/SkBitmapDevice.h" | 10 #include "third_party/skia/include/core/SkBitmapDevice.h" |
| 11 #include "ui/compositor/compositor.h" | 11 #include "ui/compositor/compositor.h" |
| 12 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
| 13 #include "ui/gfx/ozone/surface_factory_ozone.h" | 13 #include "ui/gfx/ozone/surface_factory_ozone.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
| 16 #include "ui/gfx/vsync_provider.h" |
| 16 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class MockSurfaceFactoryOzone : public gfx::SurfaceFactoryOzone { | 21 class MockSurfaceFactoryOzone : public gfx::SurfaceFactoryOzone { |
| 21 public: | 22 public: |
| 22 MockSurfaceFactoryOzone() {} | 23 MockSurfaceFactoryOzone() {} |
| 23 virtual ~MockSurfaceFactoryOzone() {} | 24 virtual ~MockSurfaceFactoryOzone() {} |
| 24 | 25 |
| 25 virtual HardwareState InitializeHardware() OVERRIDE { | 26 virtual HardwareState InitializeHardware() OVERRIDE { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config, | 41 device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config, |
| 41 bounds.width(), | 42 bounds.width(), |
| 42 bounds.height(), | 43 bounds.height(), |
| 43 true)); | 44 true)); |
| 44 canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); | 45 canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); |
| 45 return true; | 46 return true; |
| 46 } | 47 } |
| 47 virtual SkCanvas* GetCanvasForWidget(gfx::AcceleratedWidget w) OVERRIDE { | 48 virtual SkCanvas* GetCanvasForWidget(gfx::AcceleratedWidget w) OVERRIDE { |
| 48 return canvas_.get(); | 49 return canvas_.get(); |
| 49 } | 50 } |
| 50 virtual gfx::VSyncProvider* GetVSyncProvider( | 51 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider( |
| 51 gfx::AcceleratedWidget w) OVERRIDE { | 52 gfx::AcceleratedWidget w) OVERRIDE { |
| 52 return NULL; | 53 return scoped_ptr<gfx::VSyncProvider>(); |
| 53 } | 54 } |
| 54 private: | 55 private: |
| 55 skia::RefPtr<SkBitmapDevice> device_; | 56 skia::RefPtr<SkBitmapDevice> device_; |
| 56 skia::RefPtr<SkCanvas> canvas_; | 57 skia::RefPtr<SkCanvas> canvas_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(MockSurfaceFactoryOzone); | 59 DISALLOW_COPY_AND_ASSIGN(MockSurfaceFactoryOzone); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace | 62 } // namespace |
| 62 | 63 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // painted. | 187 // painted. |
| 187 for (int i = 0; i < area.height(); ++i) { | 188 for (int i = 0; i < area.height(); ++i) { |
| 188 for (int j = 0; j < area.width(); ++j) { | 189 for (int j = 0; j < area.width(); ++j) { |
| 189 if (j < damage.width() && i < damage.height()) | 190 if (j < damage.width() && i < damage.height()) |
| 190 EXPECT_EQ(SK_ColorWHITE, bitmap.getColor(j, i)); | 191 EXPECT_EQ(SK_ColorWHITE, bitmap.getColor(j, i)); |
| 191 else | 192 else |
| 192 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(j, i)); | 193 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(j, i)); |
| 193 } | 194 } |
| 194 } | 195 } |
| 195 } | 196 } |
| OLD | NEW |