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.
5 #ifndef UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_
6 #define UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_
10 #include "base/macros.h"
11 #include "ui/display/chromeos/test/action_logger.h"
12 #include "ui/display/chromeos/test/action_logger_util.h"
13 #include "ui/display/types/native_display_delegate.h"
18 class DisplaySnapshot
;
22 class TestNativeDisplayDelegate
: public NativeDisplayDelegate
{
24 // Ownership of |log| remains with the caller.
25 explicit TestNativeDisplayDelegate(ActionLogger
* log
);
26 ~TestNativeDisplayDelegate() override
;
28 const std::vector
<DisplaySnapshot
*>& outputs() const { return outputs_
; }
30 void set_outputs(const std::vector
<DisplaySnapshot
*>& outputs
) {
34 void set_max_configurable_pixels(int pixels
) {
35 max_configurable_pixels_
= pixels
;
38 void set_get_hdcp_state_expectation(bool success
) {
39 get_hdcp_expectation_
= success
;
42 void set_set_hdcp_state_expectation(bool success
) {
43 set_hdcp_expectation_
= success
;
46 void set_hdcp_state(HDCPState state
) { hdcp_state_
= state
; }
48 void set_run_async(bool run_async
) { run_async_
= run_async
; }
50 // NativeDisplayDelegate overrides:
51 void Initialize() override
;
52 void GrabServer() override
;
53 void UngrabServer() override
;
54 void TakeDisplayControl(const DisplayControlCallback
& callback
) override
;
55 void RelinquishDisplayControl(
56 const DisplayControlCallback
& callback
) override
;
57 void SyncWithServer() override
;
58 void SetBackgroundColor(uint32_t color_argb
) override
;
59 void ForceDPMSOn() override
;
60 void GetDisplays(const GetDisplaysCallback
& callback
) override
;
61 void AddMode(const DisplaySnapshot
& output
, const DisplayMode
* mode
) override
;
62 void Configure(const DisplaySnapshot
& output
,
63 const DisplayMode
* mode
,
64 const gfx::Point
& origin
,
65 const ConfigureCallback
& callback
) override
;
66 void CreateFrameBuffer(const gfx::Size
& size
) override
;
67 void GetHDCPState(const DisplaySnapshot
& output
,
68 const GetHDCPStateCallback
& callback
) override
;
69 void SetHDCPState(const DisplaySnapshot
& output
,
71 const SetHDCPStateCallback
& callback
) override
;
72 std::vector
<ui::ColorCalibrationProfile
> GetAvailableColorCalibrationProfiles(
73 const DisplaySnapshot
& output
) override
;
74 bool SetColorCalibrationProfile(
75 const DisplaySnapshot
& output
,
76 ui::ColorCalibrationProfile new_profile
) override
;
77 bool SetGammaRamp(const ui::DisplaySnapshot
& output
,
78 const std::vector
<GammaRampRGBEntry
>& lut
) override
;
79 void AddObserver(NativeDisplayObserver
* observer
) override
;
80 void RemoveObserver(NativeDisplayObserver
* observer
) override
;
83 bool Configure(const DisplaySnapshot
& output
,
84 const DisplayMode
* mode
,
85 const gfx::Point
& origin
);
87 // Outputs to be returned by GetDisplays().
88 std::vector
<DisplaySnapshot
*> outputs_
;
90 // |max_configurable_pixels_| represents the maximum number of pixels that
91 // Configure will support. Tests can use this to force Configure
92 // to fail if attempting to set a resolution that is higher than what
93 // a device might support under a given circumstance.
94 // A value of 0 means that no limit is enforced and Configure will
95 // return success regardless of the resolution.
96 int max_configurable_pixels_
;
98 bool get_hdcp_expectation_
;
99 bool set_hdcp_expectation_
;
101 // Result value of GetHDCPState().
102 HDCPState hdcp_state_
;
104 // If true, the callbacks are posted on the message loop.
107 ActionLogger
* log_
; // Not owned.
109 DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate
);
115 #endif // UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_