| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_ | |
| 6 #define UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "ui/display/chromeos/test/action_logger.h" | |
| 14 #include "ui/display/chromeos/test/action_logger_util.h" | |
| 15 #include "ui/display/types/native_display_delegate.h" | |
| 16 | |
| 17 namespace ui { | |
| 18 | |
| 19 class ActionLogger; | |
| 20 class DisplaySnapshot; | |
| 21 | |
| 22 namespace test { | |
| 23 | |
| 24 class TestNativeDisplayDelegate : public NativeDisplayDelegate { | |
| 25 public: | |
| 26 // Ownership of |log| remains with the caller. | |
| 27 explicit TestNativeDisplayDelegate(ActionLogger* log); | |
| 28 ~TestNativeDisplayDelegate() override; | |
| 29 | |
| 30 const std::vector<DisplaySnapshot*>& outputs() const { return outputs_; } | |
| 31 | |
| 32 void set_outputs(const std::vector<DisplaySnapshot*>& outputs) { | |
| 33 outputs_ = outputs; | |
| 34 } | |
| 35 | |
| 36 void set_max_configurable_pixels(int pixels) { | |
| 37 max_configurable_pixels_ = pixels; | |
| 38 } | |
| 39 | |
| 40 void set_get_hdcp_state_expectation(bool success) { | |
| 41 get_hdcp_expectation_ = success; | |
| 42 } | |
| 43 | |
| 44 void set_set_hdcp_state_expectation(bool success) { | |
| 45 set_hdcp_expectation_ = success; | |
| 46 } | |
| 47 | |
| 48 void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } | |
| 49 | |
| 50 void set_run_async(bool run_async) { run_async_ = run_async; } | |
| 51 | |
| 52 // NativeDisplayDelegate overrides: | |
| 53 void Initialize() override; | |
| 54 void GrabServer() override; | |
| 55 void UngrabServer() override; | |
| 56 void TakeDisplayControl(const DisplayControlCallback& callback) override; | |
| 57 void RelinquishDisplayControl( | |
| 58 const DisplayControlCallback& callback) override; | |
| 59 void SyncWithServer() override; | |
| 60 void SetBackgroundColor(uint32_t color_argb) override; | |
| 61 void ForceDPMSOn() override; | |
| 62 void GetDisplays(const GetDisplaysCallback& callback) override; | |
| 63 void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override; | |
| 64 void Configure(const DisplaySnapshot& output, | |
| 65 const DisplayMode* mode, | |
| 66 const gfx::Point& origin, | |
| 67 const ConfigureCallback& callback) override; | |
| 68 void CreateFrameBuffer(const gfx::Size& size) override; | |
| 69 void GetHDCPState(const DisplaySnapshot& output, | |
| 70 const GetHDCPStateCallback& callback) override; | |
| 71 void SetHDCPState(const DisplaySnapshot& output, | |
| 72 HDCPState state, | |
| 73 const SetHDCPStateCallback& callback) override; | |
| 74 std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( | |
| 75 const DisplaySnapshot& output) override; | |
| 76 bool SetColorCalibrationProfile( | |
| 77 const DisplaySnapshot& output, | |
| 78 ui::ColorCalibrationProfile new_profile) override; | |
| 79 bool SetColorCorrection(const ui::DisplaySnapshot& output, | |
| 80 const std::vector<GammaRampRGBEntry>& degamma_lut, | |
| 81 const std::vector<GammaRampRGBEntry>& gamma_lut, | |
| 82 const std::vector<float>& correction_matrix) override; | |
| 83 void AddObserver(NativeDisplayObserver* observer) override; | |
| 84 void RemoveObserver(NativeDisplayObserver* observer) override; | |
| 85 display::FakeDisplayController* GetFakeDisplayController() override; | |
| 86 | |
| 87 private: | |
| 88 bool Configure(const DisplaySnapshot& output, | |
| 89 const DisplayMode* mode, | |
| 90 const gfx::Point& origin); | |
| 91 | |
| 92 // Outputs to be returned by GetDisplays(). | |
| 93 std::vector<DisplaySnapshot*> outputs_; | |
| 94 | |
| 95 // |max_configurable_pixels_| represents the maximum number of pixels that | |
| 96 // Configure will support. Tests can use this to force Configure | |
| 97 // to fail if attempting to set a resolution that is higher than what | |
| 98 // a device might support under a given circumstance. | |
| 99 // A value of 0 means that no limit is enforced and Configure will | |
| 100 // return success regardless of the resolution. | |
| 101 int max_configurable_pixels_; | |
| 102 | |
| 103 bool get_hdcp_expectation_; | |
| 104 bool set_hdcp_expectation_; | |
| 105 | |
| 106 // Result value of GetHDCPState(). | |
| 107 HDCPState hdcp_state_; | |
| 108 | |
| 109 // If true, the callbacks are posted on the message loop. | |
| 110 bool run_async_; | |
| 111 | |
| 112 ActionLogger* log_; // Not owned. | |
| 113 | |
| 114 DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate); | |
| 115 }; | |
| 116 | |
| 117 } // namespace test | |
| 118 } // namespace ui | |
| 119 | |
| 120 #endif // UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_ | |
| OLD | NEW |