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 #include "ui/display/chromeos/test/action_logger_util.h"
7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h"
9 #include "ui/display/types/display_mode.h"
10 #include "ui/display/types/display_snapshot.h"
11 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/geometry/size.h"
17 std::string
DisplaySnapshotToString(const DisplaySnapshot
& output
) {
18 return base::StringPrintf("id=%" PRId64
, output
.display_id());
21 std::string
GetBackgroundAction(uint32_t color_argb
) {
22 return base::StringPrintf("background(0x%x)", color_argb
);
25 std::string
GetAddOutputModeAction(const DisplaySnapshot
& output
,
26 const DisplayMode
* mode
) {
27 return base::StringPrintf("add_mode(output=%" PRId64
",mode=%s)",
28 output
.display_id(), mode
->ToString().c_str());
31 std::string
GetCrtcAction(const DisplaySnapshot
& output
,
32 const DisplayMode
* mode
,
33 const gfx::Point
& origin
) {
34 return base::StringPrintf("crtc(display=[%s],x=%d,y=%d,mode=[%s])",
35 DisplaySnapshotToString(output
).c_str(), origin
.x(),
37 mode
? mode
->ToString().c_str() : "NULL");
40 std::string
GetFramebufferAction(const gfx::Size
& size
,
41 const DisplaySnapshot
* out1
,
42 const DisplaySnapshot
* out2
) {
43 return base::StringPrintf(
44 "framebuffer(width=%d,height=%d,display1=%s,display2=%s)", size
.width(),
45 size
.height(), out1
? DisplaySnapshotToString(*out1
).c_str() : "NULL",
46 out2
? DisplaySnapshotToString(*out2
).c_str() : "NULL");
49 std::string
GetSetHDCPStateAction(const DisplaySnapshot
& output
,
51 return base::StringPrintf("set_hdcp(id=%" PRId64
",state=%d)",
52 output
.display_id(), state
);
55 std::string
JoinActions(const char* action
, ...) {
59 va_start(arg_list
, action
);
64 action
= va_arg(arg_list
, const char*);