Correctly track texture cleared state for sharing
[chromium-blink-merge.git] / ui / display / chromeos / test / action_logger_util.cc
blobc798b48c06c468d051c42353bcd1389375188796
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"
14 namespace ui {
15 namespace test {
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(),
36 origin.y(),
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,
50 HDCPState state) {
51 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)",
52 output.display_id(), state);
55 std::string JoinActions(const char* action, ...) {
56 std::string actions;
58 va_list arg_list;
59 va_start(arg_list, action);
60 while (action) {
61 if (!actions.empty())
62 actions += ",";
63 actions += action;
64 action = va_arg(arg_list, const char*);
66 va_end(arg_list);
67 return actions;
70 } // namespace test
71 } // namespace ui