summaryrefslogtreecommitdiffstats
path: root/ui/display/chromeos
diff options
context:
space:
mode:
authordnicoara <dnicoara@chromium.org>2014-12-09 17:06:27 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-10 01:07:32 +0000
commitae65a67d5c069284eda67e77463d5e235195c5b5 (patch)
tree08a390266d277277be2bc5d47c20db16c374a04f /ui/display/chromeos
parent2f932547f901ada94b034cbac13ffc827d827686 (diff)
downloadchromium_src-ae65a67d5c069284eda67e77463d5e235195c5b5.zip
chromium_src-ae65a67d5c069284eda67e77463d5e235195c5b5.tar.gz
chromium_src-ae65a67d5c069284eda67e77463d5e235195c5b5.tar.bz2
Extract display testing code so that it can be shared with others
No functional change intended. BUG=429746 Review URL: https://codereview.chromium.org/790793003 Cr-Commit-Position: refs/heads/master@{#307606}
Diffstat (limited to 'ui/display/chromeos')
-rw-r--r--ui/display/chromeos/display_configurator_unittest.cc236
-rw-r--r--ui/display/chromeos/test/action_logger.cc29
-rw-r--r--ui/display/chromeos/test/action_logger.h36
-rw-r--r--ui/display/chromeos/test/action_logger_util.cc71
-rw-r--r--ui/display/chromeos/test/action_logger_util.h74
-rw-r--r--ui/display/chromeos/test/test_native_display_delegate.cc117
-rw-r--r--ui/display/chromeos/test/test_native_display_delegate.h88
7 files changed, 419 insertions, 232 deletions
diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc
index cdcd901..12516e9 100644
--- a/ui/display/chromeos/display_configurator_unittest.cc
+++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -4,247 +4,18 @@
#include "ui/display/chromeos/display_configurator.h"
-#include <stdint.h>
-
-#include <cmath>
-#include <cstdarg>
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
-#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/display/chromeos/test/action_logger_util.h"
#include "ui/display/chromeos/test/test_display_snapshot.h"
-#include "ui/display/types/display_mode.h"
-#include "ui/display/types/native_display_delegate.h"
+#include "ui/display/chromeos/test/test_native_display_delegate.h"
namespace ui {
+namespace test {
namespace {
-// Strings returned by TestNativeDisplayDelegate::GetActionsAndClear() to
-// describe various actions that were performed.
-const char kInitXRandR[] = "init";
-const char kGrab[] = "grab";
-const char kUngrab[] = "ungrab";
-const char kSync[] = "sync";
-const char kForceDPMS[] = "dpms";
-const char kTakeDisplayControl[] = "take";
-const char kRelinquishDisplayControl[] = "relinquish";
-
-// String returned by TestNativeDisplayDelegate::GetActionsAndClear() if no
-// actions were requested.
-const char kNoActions[] = "";
-
-std::string DisplaySnapshotToString(const DisplaySnapshot& output) {
- return base::StringPrintf("id=%" PRId64, output.display_id());
-}
-
-// Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor()
-// call.
-std::string GetBackgroundAction(uint32_t color_argb) {
- return base::StringPrintf("background(0x%x)", color_argb);
-}
-
-// Returns a string describing a TestNativeDisplayDelegate::AddOutputMode()
-// call.
-std::string GetAddOutputModeAction(const DisplaySnapshot& output,
- const DisplayMode* mode) {
- return base::StringPrintf("add_mode(output=%" PRId64 ",mode=%s)",
- output.display_id(),
- mode->ToString().c_str());
-}
-
-// Returns a string describing a TestNativeDisplayDelegate::Configure()
-// call.
-std::string GetCrtcAction(const DisplaySnapshot& output,
- const DisplayMode* mode,
- const gfx::Point& origin) {
- return base::StringPrintf("crtc(display=[%s],x=%d,y=%d,mode=[%s])",
- DisplaySnapshotToString(output).c_str(),
- origin.x(),
- origin.y(),
- mode ? mode->ToString().c_str() : "NULL");
-}
-
-// Returns a string describing a TestNativeDisplayDelegate::CreateFramebuffer()
-// call.
-std::string GetFramebufferAction(const gfx::Size& size,
- const DisplaySnapshot* out1,
- const DisplaySnapshot* out2) {
- return base::StringPrintf(
- "framebuffer(width=%d,height=%d,display1=%s,display2=%s)",
- size.width(),
- size.height(),
- out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL",
- out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL");
-}
-
-// Returns a string describing a TestNativeDisplayDelegate::SetHDCPState() call.
-std::string GetSetHDCPStateAction(const DisplaySnapshot& output,
- HDCPState state) {
- return base::StringPrintf(
- "set_hdcp(id=%" PRId64 ",state=%d)", output.display_id(), state);
-}
-
-// Joins a sequence of strings describing actions (e.g. kScreenDim) such
-// that they can be compared against a string returned by
-// ActionLogger::GetActionsAndClear(). The list of actions must be
-// terminated by a NULL pointer.
-std::string JoinActions(const char* action, ...) {
- std::string actions;
-
- va_list arg_list;
- va_start(arg_list, action);
- while (action) {
- if (!actions.empty())
- actions += ",";
- actions += action;
- action = va_arg(arg_list, const char*);
- }
- va_end(arg_list);
- return actions;
-}
-
-class ActionLogger {
- public:
- ActionLogger() {}
-
- void AppendAction(const std::string& action) {
- if (!actions_.empty())
- actions_ += ",";
- actions_ += action;
- }
-
- // Returns a comma-separated string describing the actions that were
- // requested since the previous call to GetActionsAndClear() (i.e.
- // results are non-repeatable).
- std::string GetActionsAndClear() {
- std::string actions = actions_;
- actions_.clear();
- return actions;
- }
-
- private:
- std::string actions_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionLogger);
-};
-
-class TestNativeDisplayDelegate : public NativeDisplayDelegate {
- public:
- // Ownership of |log| remains with the caller.
- explicit TestNativeDisplayDelegate(ActionLogger* log)
- : max_configurable_pixels_(0),
- hdcp_state_(HDCP_STATE_UNDESIRED),
- log_(log) {}
- virtual ~TestNativeDisplayDelegate() {}
-
- const std::vector<DisplaySnapshot*>& outputs() const { return outputs_; }
- void set_outputs(const std::vector<DisplaySnapshot*>& outputs) {
- outputs_ = outputs;
- }
-
- void set_max_configurable_pixels(int pixels) {
- max_configurable_pixels_ = pixels;
- }
-
- void set_hdcp_state(HDCPState state) { hdcp_state_ = state; }
-
- // DisplayConfigurator::Delegate overrides:
- virtual void Initialize() override { log_->AppendAction(kInitXRandR); }
- virtual void GrabServer() override { log_->AppendAction(kGrab); }
- virtual void UngrabServer() override { log_->AppendAction(kUngrab); }
- virtual bool TakeDisplayControl() override {
- log_->AppendAction(kTakeDisplayControl);
- return true;
- }
- virtual bool RelinquishDisplayControl() override {
- log_->AppendAction(kRelinquishDisplayControl);
- return true;
- }
- virtual void SyncWithServer() override { log_->AppendAction(kSync); }
- virtual void SetBackgroundColor(uint32_t color_argb) override {
- log_->AppendAction(GetBackgroundAction(color_argb));
- }
- virtual void ForceDPMSOn() override { log_->AppendAction(kForceDPMS); }
- virtual std::vector<DisplaySnapshot*> GetDisplays() override {
- return outputs_;
- }
- virtual void AddMode(const DisplaySnapshot& output,
- const DisplayMode* mode) override {
- log_->AppendAction(GetAddOutputModeAction(output, mode));
- }
- virtual bool Configure(const DisplaySnapshot& output,
- const DisplayMode* mode,
- const gfx::Point& origin) override {
- log_->AppendAction(GetCrtcAction(output, mode, origin));
-
- if (max_configurable_pixels_ == 0)
- return true;
-
- if (!mode)
- return false;
-
- return mode->size().GetArea() <= max_configurable_pixels_;
- }
- virtual void CreateFrameBuffer(const gfx::Size& size) override {
- log_->AppendAction(
- GetFramebufferAction(size,
- outputs_.size() >= 1 ? outputs_[0] : NULL,
- outputs_.size() >= 2 ? outputs_[1] : NULL));
- }
- virtual bool GetHDCPState(const DisplaySnapshot& output,
- HDCPState* state) override {
- *state = hdcp_state_;
- return true;
- }
-
- virtual bool SetHDCPState(const DisplaySnapshot& output,
- HDCPState state) override {
- log_->AppendAction(GetSetHDCPStateAction(output, state));
- return true;
- }
-
- virtual std::vector<ui::ColorCalibrationProfile>
- GetAvailableColorCalibrationProfiles(const DisplaySnapshot& output) override {
- return std::vector<ui::ColorCalibrationProfile>();
- }
-
- virtual bool SetColorCalibrationProfile(
- const DisplaySnapshot& output,
- ui::ColorCalibrationProfile new_profile) override {
- return false;
- }
-
- virtual void AddObserver(NativeDisplayObserver* observer) override {}
-
- virtual void RemoveObserver(NativeDisplayObserver* observer) override {}
-
- private:
- // Outputs to be returned by GetDisplays().
- std::vector<DisplaySnapshot*> outputs_;
-
- // |max_configurable_pixels_| represents the maximum number of pixels that
- // Configure will support. Tests can use this to force Configure
- // to fail if attempting to set a resolution that is higher than what
- // a device might support under a given circumstance.
- // A value of 0 means that no limit is enforced and Configure will
- // return success regardless of the resolution.
- int max_configurable_pixels_;
-
- // Result value of GetHDCPState().
- HDCPState hdcp_state_;
-
- ActionLogger* log_; // Not owned.
-
- DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate);
-};
-
class TestObserver : public DisplayConfigurator::Observer {
public:
explicit TestObserver(DisplayConfigurator* configurator)
@@ -1421,4 +1192,5 @@ TEST_F(DisplayConfiguratorTest, ExternalControl) {
log_->GetActionsAndClear());
}
+} // namespace test
} // namespace ui
diff --git a/ui/display/chromeos/test/action_logger.cc b/ui/display/chromeos/test/action_logger.cc
new file mode 100644
index 0000000..2afcb48
--- /dev/null
+++ b/ui/display/chromeos/test/action_logger.cc
@@ -0,0 +1,29 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/display/chromeos/test/action_logger.h"
+
+namespace ui {
+namespace test {
+
+ActionLogger::ActionLogger() {
+}
+
+ActionLogger::~ActionLogger() {
+}
+
+void ActionLogger::AppendAction(const std::string& action) {
+ if (!actions_.empty())
+ actions_ += ",";
+ actions_ += action;
+}
+
+std::string ActionLogger::GetActionsAndClear() {
+ std::string actions = actions_;
+ actions_.clear();
+ return actions;
+}
+
+} // namespace test
+} // namespace ui
diff --git a/ui/display/chromeos/test/action_logger.h b/ui/display/chromeos/test/action_logger.h
new file mode 100644
index 0000000..92028fc
--- /dev/null
+++ b/ui/display/chromeos/test/action_logger.h
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_H_
+#define UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_H_
+
+#include <string>
+
+#include "base/macros.h"
+
+namespace ui {
+namespace test {
+
+class ActionLogger {
+ public:
+ ActionLogger();
+ ~ActionLogger();
+
+ void AppendAction(const std::string& action);
+
+ // Returns a comma-separated string describing the actions that were
+ // requested since the previous call to GetActionsAndClear() (i.e.
+ // results are non-repeatable).
+ std::string GetActionsAndClear();
+
+ private:
+ std::string actions_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActionLogger);
+};
+
+} // namespace test
+} // namespace ui
+
+#endif // UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_H_
diff --git a/ui/display/chromeos/test/action_logger_util.cc b/ui/display/chromeos/test/action_logger_util.cc
new file mode 100644
index 0000000..c798b48
--- /dev/null
+++ b/ui/display/chromeos/test/action_logger_util.cc
@@ -0,0 +1,71 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/display/chromeos/test/action_logger_util.h"
+
+#include "base/format_macros.h"
+#include "base/strings/stringprintf.h"
+#include "ui/display/types/display_mode.h"
+#include "ui/display/types/display_snapshot.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace ui {
+namespace test {
+
+std::string DisplaySnapshotToString(const DisplaySnapshot& output) {
+ return base::StringPrintf("id=%" PRId64, output.display_id());
+}
+
+std::string GetBackgroundAction(uint32_t color_argb) {
+ return base::StringPrintf("background(0x%x)", color_argb);
+}
+
+std::string GetAddOutputModeAction(const DisplaySnapshot& output,
+ const DisplayMode* mode) {
+ return base::StringPrintf("add_mode(output=%" PRId64 ",mode=%s)",
+ output.display_id(), mode->ToString().c_str());
+}
+
+std::string GetCrtcAction(const DisplaySnapshot& output,
+ const DisplayMode* mode,
+ const gfx::Point& origin) {
+ return base::StringPrintf("crtc(display=[%s],x=%d,y=%d,mode=[%s])",
+ DisplaySnapshotToString(output).c_str(), origin.x(),
+ origin.y(),
+ mode ? mode->ToString().c_str() : "NULL");
+}
+
+std::string GetFramebufferAction(const gfx::Size& size,
+ const DisplaySnapshot* out1,
+ const DisplaySnapshot* out2) {
+ return base::StringPrintf(
+ "framebuffer(width=%d,height=%d,display1=%s,display2=%s)", size.width(),
+ size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL",
+ out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL");
+}
+
+std::string GetSetHDCPStateAction(const DisplaySnapshot& output,
+ HDCPState state) {
+ return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)",
+ output.display_id(), state);
+}
+
+std::string JoinActions(const char* action, ...) {
+ std::string actions;
+
+ va_list arg_list;
+ va_start(arg_list, action);
+ while (action) {
+ if (!actions.empty())
+ actions += ",";
+ actions += action;
+ action = va_arg(arg_list, const char*);
+ }
+ va_end(arg_list);
+ return actions;
+}
+
+} // namespace test
+} // namespace ui
diff --git a/ui/display/chromeos/test/action_logger_util.h b/ui/display/chromeos/test/action_logger_util.h
new file mode 100644
index 0000000..4b66cd1
--- /dev/null
+++ b/ui/display/chromeos/test/action_logger_util.h
@@ -0,0 +1,74 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_UTIL_H_
+#define UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_UTIL_H_
+
+#include <string>
+
+#include "ui/display/types/display_constants.h"
+
+namespace gfx {
+class Point;
+class Size;
+} // namespace gfx
+
+namespace ui {
+
+class DisplayMode;
+class DisplaySnapshot;
+
+namespace test {
+
+// Strings returned by TestNativeDisplayDelegate::GetActionsAndClear() to
+// describe various actions that were performed.
+const char kInitXRandR[] = "init";
+const char kGrab[] = "grab";
+const char kUngrab[] = "ungrab";
+const char kSync[] = "sync";
+const char kForceDPMS[] = "dpms";
+const char kTakeDisplayControl[] = "take";
+const char kRelinquishDisplayControl[] = "relinquish";
+
+// String returned by TestNativeDisplayDelegate::GetActionsAndClear() if no
+// actions were requested.
+const char kNoActions[] = "";
+
+std::string DisplaySnapshotToString(const DisplaySnapshot& output);
+
+// Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor()
+// call.
+std::string GetBackgroundAction(uint32_t color_argb);
+
+// Returns a string describing a TestNativeDisplayDelegate::AddOutputMode()
+// call.
+std::string GetAddOutputModeAction(const DisplaySnapshot& output,
+ const DisplayMode* mode);
+
+// Returns a string describing a TestNativeDisplayDelegate::Configure()
+// call.
+std::string GetCrtcAction(const DisplaySnapshot& output,
+ const DisplayMode* mode,
+ const gfx::Point& origin);
+
+// Returns a string describing a TestNativeDisplayDelegate::CreateFramebuffer()
+// call.
+std::string GetFramebufferAction(const gfx::Size& size,
+ const DisplaySnapshot* out1,
+ const DisplaySnapshot* out2);
+
+// Returns a string describing a TestNativeDisplayDelegate::SetHDCPState() call.
+std::string GetSetHDCPStateAction(const DisplaySnapshot& output,
+ HDCPState state);
+
+// Joins a sequence of strings describing actions (e.g. kScreenDim) such
+// that they can be compared against a string returned by
+// ActionLogger::GetActionsAndClear(). The list of actions must be
+// terminated by a NULL pointer.
+std::string JoinActions(const char* action, ...);
+
+} // namespace test
+} // namespace ui
+
+#endif // UI_DISPLAY_CHROMEOS_TEST_ACTION_LOGGER_UTIL_H_
diff --git a/ui/display/chromeos/test/test_native_display_delegate.cc b/ui/display/chromeos/test/test_native_display_delegate.cc
new file mode 100644
index 0000000..fd4b1d7
--- /dev/null
+++ b/ui/display/chromeos/test/test_native_display_delegate.cc
@@ -0,0 +1,117 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/display/chromeos/test/test_native_display_delegate.h"
+
+#include "ui/display/chromeos/test/action_logger.h"
+#include "ui/display/types/display_mode.h"
+
+namespace ui {
+namespace test {
+
+TestNativeDisplayDelegate::TestNativeDisplayDelegate(ActionLogger* log)
+ : max_configurable_pixels_(0),
+ hdcp_state_(HDCP_STATE_UNDESIRED),
+ log_(log) {
+}
+
+TestNativeDisplayDelegate::~TestNativeDisplayDelegate() {
+}
+
+void TestNativeDisplayDelegate::Initialize() {
+ log_->AppendAction(kInitXRandR);
+}
+
+void TestNativeDisplayDelegate::GrabServer() {
+ log_->AppendAction(kGrab);
+}
+
+void TestNativeDisplayDelegate::UngrabServer() {
+ log_->AppendAction(kUngrab);
+}
+
+bool TestNativeDisplayDelegate::TakeDisplayControl() {
+ log_->AppendAction(kTakeDisplayControl);
+ return true;
+}
+
+bool TestNativeDisplayDelegate::RelinquishDisplayControl() {
+ log_->AppendAction(kRelinquishDisplayControl);
+ return true;
+}
+
+void TestNativeDisplayDelegate::SyncWithServer() {
+ log_->AppendAction(kSync);
+}
+
+void TestNativeDisplayDelegate::SetBackgroundColor(uint32_t color_argb) {
+ log_->AppendAction(GetBackgroundAction(color_argb));
+}
+
+void TestNativeDisplayDelegate::ForceDPMSOn() {
+ log_->AppendAction(kForceDPMS);
+}
+
+std::vector<DisplaySnapshot*> TestNativeDisplayDelegate::GetDisplays() {
+ return outputs_;
+}
+
+void TestNativeDisplayDelegate::AddMode(const DisplaySnapshot& output,
+ const DisplayMode* mode) {
+ log_->AppendAction(GetAddOutputModeAction(output, mode));
+}
+
+bool TestNativeDisplayDelegate::Configure(const DisplaySnapshot& output,
+ const DisplayMode* mode,
+ const gfx::Point& origin) {
+ log_->AppendAction(GetCrtcAction(output, mode, origin));
+
+ if (max_configurable_pixels_ == 0)
+ return true;
+
+ if (!mode)
+ return false;
+
+ return mode->size().GetArea() <= max_configurable_pixels_;
+}
+
+void TestNativeDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) {
+ log_->AppendAction(
+ GetFramebufferAction(size, outputs_.size() >= 1 ? outputs_[0] : NULL,
+ outputs_.size() >= 2 ? outputs_[1] : NULL));
+}
+
+bool TestNativeDisplayDelegate::GetHDCPState(const DisplaySnapshot& output,
+ HDCPState* state) {
+ *state = hdcp_state_;
+ return true;
+}
+
+bool TestNativeDisplayDelegate::SetHDCPState(const DisplaySnapshot& output,
+ HDCPState state) {
+ log_->AppendAction(GetSetHDCPStateAction(output, state));
+ return true;
+}
+
+std::vector<ui::ColorCalibrationProfile>
+TestNativeDisplayDelegate::GetAvailableColorCalibrationProfiles(
+ const DisplaySnapshot& output) {
+ return std::vector<ui::ColorCalibrationProfile>();
+}
+
+bool TestNativeDisplayDelegate::SetColorCalibrationProfile(
+ const DisplaySnapshot& output,
+ ui::ColorCalibrationProfile new_profile) {
+ return false;
+}
+
+void TestNativeDisplayDelegate::AddObserver(NativeDisplayObserver* observer) {
+}
+
+void TestNativeDisplayDelegate::RemoveObserver(
+ NativeDisplayObserver* observer) {
+}
+
+} // namespace test
+} // namespace ui
diff --git a/ui/display/chromeos/test/test_native_display_delegate.h b/ui/display/chromeos/test/test_native_display_delegate.h
new file mode 100644
index 0000000..968a513
--- /dev/null
+++ b/ui/display/chromeos/test/test_native_display_delegate.h
@@ -0,0 +1,88 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_
+#define UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "ui/display/chromeos/test/action_logger.h"
+#include "ui/display/chromeos/test/action_logger_util.h"
+#include "ui/display/types/native_display_delegate.h"
+
+namespace ui {
+
+class ActionLogger;
+class DisplaySnapshot;
+
+namespace test {
+
+class TestNativeDisplayDelegate : public NativeDisplayDelegate {
+ public:
+ // Ownership of |log| remains with the caller.
+ explicit TestNativeDisplayDelegate(ActionLogger* log);
+ ~TestNativeDisplayDelegate() override;
+
+ const std::vector<DisplaySnapshot*>& outputs() const { return outputs_; }
+
+ void set_outputs(const std::vector<DisplaySnapshot*>& outputs) {
+ outputs_ = outputs;
+ }
+
+ void set_max_configurable_pixels(int pixels) {
+ max_configurable_pixels_ = pixels;
+ }
+
+ void set_hdcp_state(HDCPState state) { hdcp_state_ = state; }
+
+ // NativeDisplayDelegate overrides:
+ void Initialize() override;
+ void GrabServer() override;
+ void UngrabServer() override;
+ bool TakeDisplayControl() override;
+ bool RelinquishDisplayControl() override;
+ void SyncWithServer() override;
+ void SetBackgroundColor(uint32_t color_argb) override;
+ void ForceDPMSOn() override;
+ std::vector<DisplaySnapshot*> GetDisplays() override;
+ void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override;
+ bool Configure(const DisplaySnapshot& output,
+ const DisplayMode* mode,
+ const gfx::Point& origin) override;
+ void CreateFrameBuffer(const gfx::Size& size) override;
+ bool GetHDCPState(const DisplaySnapshot& output, HDCPState* state) override;
+ bool SetHDCPState(const DisplaySnapshot& output, HDCPState state) override;
+ std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles(
+ const DisplaySnapshot& output) override;
+ bool SetColorCalibrationProfile(
+ const DisplaySnapshot& output,
+ ui::ColorCalibrationProfile new_profile) override;
+ void AddObserver(NativeDisplayObserver* observer) override;
+ void RemoveObserver(NativeDisplayObserver* observer) override;
+
+ private:
+ // Outputs to be returned by GetDisplays().
+ std::vector<DisplaySnapshot*> outputs_;
+
+ // |max_configurable_pixels_| represents the maximum number of pixels that
+ // Configure will support. Tests can use this to force Configure
+ // to fail if attempting to set a resolution that is higher than what
+ // a device might support under a given circumstance.
+ // A value of 0 means that no limit is enforced and Configure will
+ // return success regardless of the resolution.
+ int max_configurable_pixels_;
+
+ // Result value of GetHDCPState().
+ HDCPState hdcp_state_;
+
+ ActionLogger* log_; // Not owned.
+
+ DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate);
+};
+
+} // namespace test
+} // namespace ui
+
+#endif // UI_DISPLAY_CHROMEOS_TEST_TEST_NATIVE_DISPLAY_DELEGATE_H_