| 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 "ui/display/chromeos/test/test_native_display_delegate.h" | 5 #include "ui/display/chromeos/test/test_native_display_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "ui/display/chromeos/test/action_logger.h" | 11 #include "ui/display/chromeos/test/action_logger.h" |
| 10 #include "ui/display/types/display_mode.h" | 12 #include "ui/display/types/display_mode.h" |
| 11 | 13 |
| 12 namespace ui { | 14 namespace ui { |
| 13 namespace test { | 15 namespace test { |
| 14 | 16 |
| 15 TestNativeDisplayDelegate::TestNativeDisplayDelegate(ActionLogger* log) | 17 TestNativeDisplayDelegate::TestNativeDisplayDelegate(ActionLogger* log) |
| 16 : max_configurable_pixels_(0), | 18 : max_configurable_pixels_(0), |
| 17 get_hdcp_expectation_(true), | 19 get_hdcp_expectation_(true), |
| 18 set_hdcp_expectation_(true), | 20 set_hdcp_expectation_(true), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 log_->AppendAction(GetBackgroundAction(color_argb)); | 58 log_->AppendAction(GetBackgroundAction(color_argb)); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void TestNativeDisplayDelegate::ForceDPMSOn() { | 61 void TestNativeDisplayDelegate::ForceDPMSOn() { |
| 60 log_->AppendAction(kForceDPMS); | 62 log_->AppendAction(kForceDPMS); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void TestNativeDisplayDelegate::GetDisplays( | 65 void TestNativeDisplayDelegate::GetDisplays( |
| 64 const GetDisplaysCallback& callback) { | 66 const GetDisplaysCallback& callback) { |
| 65 if (run_async_) { | 67 if (run_async_) { |
| 66 base::MessageLoop::current()->PostTask(FROM_HERE, | 68 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 67 base::Bind(callback, outputs_)); | 69 FROM_HERE, base::Bind(callback, outputs_)); |
| 68 } else { | 70 } else { |
| 69 callback.Run(outputs_); | 71 callback.Run(outputs_); |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 | 74 |
| 73 void TestNativeDisplayDelegate::AddMode(const DisplaySnapshot& output, | 75 void TestNativeDisplayDelegate::AddMode(const DisplaySnapshot& output, |
| 74 const DisplayMode* mode) { | 76 const DisplayMode* mode) { |
| 75 log_->AppendAction(GetAddOutputModeAction(output, mode)); | 77 log_->AppendAction(GetAddOutputModeAction(output, mode)); |
| 76 } | 78 } |
| 77 | 79 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 | 90 |
| 89 return mode->size().GetArea() <= max_configurable_pixels_; | 91 return mode->size().GetArea() <= max_configurable_pixels_; |
| 90 } | 92 } |
| 91 | 93 |
| 92 void TestNativeDisplayDelegate::Configure(const DisplaySnapshot& output, | 94 void TestNativeDisplayDelegate::Configure(const DisplaySnapshot& output, |
| 93 const DisplayMode* mode, | 95 const DisplayMode* mode, |
| 94 const gfx::Point& origin, | 96 const gfx::Point& origin, |
| 95 const ConfigureCallback& callback) { | 97 const ConfigureCallback& callback) { |
| 96 bool result = Configure(output, mode, origin); | 98 bool result = Configure(output, mode, origin); |
| 97 if (run_async_) { | 99 if (run_async_) { |
| 98 base::MessageLoop::current()->PostTask(FROM_HERE, | 100 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 99 base::Bind(callback, result)); | 101 base::Bind(callback, result)); |
| 100 } else { | 102 } else { |
| 101 callback.Run(result); | 103 callback.Run(result); |
| 102 } | 104 } |
| 103 } | 105 } |
| 104 | 106 |
| 105 void TestNativeDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) { | 107 void TestNativeDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) { |
| 106 log_->AppendAction( | 108 log_->AppendAction( |
| 107 GetFramebufferAction(size, outputs_.size() >= 1 ? outputs_[0] : NULL, | 109 GetFramebufferAction(size, outputs_.size() >= 1 ? outputs_[0] : NULL, |
| 108 outputs_.size() >= 2 ? outputs_[1] : NULL)); | 110 outputs_.size() >= 2 ? outputs_[1] : NULL)); |
| 109 } | 111 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 148 |
| 147 void TestNativeDisplayDelegate::AddObserver(NativeDisplayObserver* observer) { | 149 void TestNativeDisplayDelegate::AddObserver(NativeDisplayObserver* observer) { |
| 148 } | 150 } |
| 149 | 151 |
| 150 void TestNativeDisplayDelegate::RemoveObserver( | 152 void TestNativeDisplayDelegate::RemoveObserver( |
| 151 NativeDisplayObserver* observer) { | 153 NativeDisplayObserver* observer) { |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace test | 156 } // namespace test |
| 155 } // namespace ui | 157 } // namespace ui |
| OLD | NEW |