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_hdcp_state(HDCPState state
) { hdcp_state_
= state
; }
40 void set_run_async(bool run_async
) { run_async_
= run_async
; }
42 // NativeDisplayDelegate overrides:
43 void Initialize() override
;
44 void GrabServer() override
;
45 void UngrabServer() override
;
46 bool TakeDisplayControl() override
;
47 bool RelinquishDisplayControl() override
;
48 void SyncWithServer() override
;
49 void SetBackgroundColor(uint32_t color_argb
) override
;
50 void ForceDPMSOn() override
;
51 void GetDisplays(const GetDisplaysCallback
& callback
) override
;
52 void AddMode(const DisplaySnapshot
& output
, const DisplayMode
* mode
) override
;
53 void Configure(const DisplaySnapshot
& output
,
54 const DisplayMode
* mode
,
55 const gfx::Point
& origin
,
56 const ConfigureCallback
& callback
) override
;
57 void CreateFrameBuffer(const gfx::Size
& size
) override
;
58 bool GetHDCPState(const DisplaySnapshot
& output
, HDCPState
* state
) override
;
59 bool SetHDCPState(const DisplaySnapshot
& output
, HDCPState state
) override
;
60 std::vector
<ui::ColorCalibrationProfile
> GetAvailableColorCalibrationProfiles(
61 const DisplaySnapshot
& output
) override
;
62 bool SetColorCalibrationProfile(
63 const DisplaySnapshot
& output
,
64 ui::ColorCalibrationProfile new_profile
) override
;
65 void AddObserver(NativeDisplayObserver
* observer
) override
;
66 void RemoveObserver(NativeDisplayObserver
* observer
) override
;
69 bool Configure(const DisplaySnapshot
& output
,
70 const DisplayMode
* mode
,
71 const gfx::Point
& origin
);
73 // Outputs to be returned by GetDisplays().
74 std::vector
<DisplaySnapshot
*> outputs_
;
76 // |max_configurable_pixels_| represents the maximum number of pixels that
77 // Configure will support. Tests can use this to force Configure
78 // to fail if attempting to set a resolution that is higher than what
79 // a device might support under a given circumstance.
80 // A value of 0 means that no limit is enforced and Configure will
81 // return success regardless of the resolution.
82 int max_configurable_pixels_
;
84 // Result value of GetHDCPState().
85 HDCPState hdcp_state_
;
87 // If true, the callbacks are posted on the message loop.
90 ActionLogger
* log_
; // Not owned.
92 DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate
);
98 #endif // UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_