OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "gpu/ipc/service/direct_composition_surface_win.h" | 5 #include "gpu/ipc/service/direct_composition_surface_win.h" |
| 6 |
6 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
7 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
11 #include "base/win/scoped_gdi_object.h" | 12 #include "base/win/scoped_gdi_object.h" |
12 #include "base/win/scoped_hdc.h" | 13 #include "base/win/scoped_hdc.h" |
13 #include "base/win/scoped_select_object.h" | 14 #include "base/win/scoped_select_object.h" |
| 15 #include "gpu/command_buffer/service/feature_info.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/base/win/hidden_window.h" | 17 #include "ui/base/win/hidden_window.h" |
16 #include "ui/gfx/buffer_format_util.h" | 18 #include "ui/gfx/buffer_format_util.h" |
17 #include "ui/gfx/gdi_util.h" | 19 #include "ui/gfx/gdi_util.h" |
18 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
19 #include "ui/gl/dc_renderer_layer_params.h" | 21 #include "ui/gl/dc_renderer_layer_params.h" |
20 #include "ui/gl/gl_angle_util_win.h" | 22 #include "ui/gl/gl_angle_util_win.h" |
21 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
22 #include "ui/gl/gl_image_dxgi.h" | 24 #include "ui/gl/gl_image_dxgi.h" |
23 #include "ui/gl/gl_image_ref_counted_memory.h" | 25 #include "ui/gl/gl_image_ref_counted_memory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
35 << "GL implementation not using DirectComposition, skipping test."; | 37 << "GL implementation not using DirectComposition, skipping test."; |
36 return false; | 38 return false; |
37 } | 39 } |
38 return true; | 40 return true; |
39 } | 41 } |
40 | 42 |
41 class TestImageTransportSurfaceDelegate | 43 class TestImageTransportSurfaceDelegate |
42 : public ImageTransportSurfaceDelegate, | 44 : public ImageTransportSurfaceDelegate, |
43 public base::SupportsWeakPtr<TestImageTransportSurfaceDelegate> { | 45 public base::SupportsWeakPtr<TestImageTransportSurfaceDelegate> { |
44 public: | 46 public: |
| 47 TestImageTransportSurfaceDelegate() |
| 48 : feature_info_(new gpu::gles2::FeatureInfo()) {} |
| 49 |
45 ~TestImageTransportSurfaceDelegate() override {} | 50 ~TestImageTransportSurfaceDelegate() override {} |
46 | 51 |
47 // ImageTransportSurfaceDelegate implementation. | 52 // ImageTransportSurfaceDelegate implementation. |
48 void DidCreateAcceleratedSurfaceChildWindow( | 53 void DidCreateAcceleratedSurfaceChildWindow( |
49 SurfaceHandle parent_window, | 54 SurfaceHandle parent_window, |
50 SurfaceHandle child_window) override { | 55 SurfaceHandle child_window) override { |
51 if (parent_window) | 56 if (parent_window) |
52 ::SetParent(child_window, parent_window); | 57 ::SetParent(child_window, parent_window); |
53 } | 58 } |
54 void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override {} | 59 void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override {} |
55 const gles2::FeatureInfo* GetFeatureInfo() const override { return nullptr; } | 60 const gles2::FeatureInfo* GetFeatureInfo() const override { |
| 61 return feature_info_.get(); |
| 62 } |
56 void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override {} | 63 void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override {} |
57 void UpdateVSyncParameters(base::TimeTicks timebase, | 64 void UpdateVSyncParameters(base::TimeTicks timebase, |
58 base::TimeDelta interval) override {} | 65 base::TimeDelta interval) override {} |
59 void AddFilter(IPC::MessageFilter* message_filter) override {} | 66 void AddFilter(IPC::MessageFilter* message_filter) override {} |
60 int32_t GetRouteID() const override { return 0; } | 67 int32_t GetRouteID() const override { return 0; } |
| 68 |
| 69 private: |
| 70 scoped_refptr<gpu::gles2::FeatureInfo> feature_info_; |
61 }; | 71 }; |
62 | 72 |
63 class TestPlatformDelegate : public ui::PlatformWindowDelegate { | 73 class TestPlatformDelegate : public ui::PlatformWindowDelegate { |
64 public: | 74 public: |
65 // ui::PlatformWindowDelegate implementation. | 75 // ui::PlatformWindowDelegate implementation. |
66 void OnBoundsChanged(const gfx::Rect& new_bounds) override {} | 76 void OnBoundsChanged(const gfx::Rect& new_bounds) override {} |
67 void OnDamageRect(const gfx::Rect& damaged_region) override {} | 77 void OnDamageRect(const gfx::Rect& damaged_region) override {} |
68 void DispatchEvent(ui::Event* event) override {} | 78 void DispatchEvent(ui::Event* event) override {} |
69 void OnCloseRequest() override {} | 79 void OnCloseRequest() override {} |
70 void OnClosed() override {} | 80 void OnClosed() override {} |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); | 566 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); |
557 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) | 567 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) |
558 << std::hex << "Expected " << expected_color << " Actual " | 568 << std::hex << "Expected " << expected_color << " Actual " |
559 << actual_color; | 569 << actual_color; |
560 | 570 |
561 context = nullptr; | 571 context = nullptr; |
562 DestroySurface(std::move(surface_)); | 572 DestroySurface(std::move(surface_)); |
563 } | 573 } |
564 } // namespace | 574 } // namespace |
565 } // namespace gpu | 575 } // namespace gpu |
OLD | NEW |