OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/display/chromeos/test/action_logger_util.h" | 5 #include "ui/display/chromeos/test/action_logger_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
9 #include "ui/display/types/display_mode.h" | 10 #include "ui/display/types/display_mode.h" |
10 #include "ui/display/types/display_snapshot.h" | 11 #include "ui/display/types/display_snapshot.h" |
11 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 namespace test { | 16 namespace test { |
16 | 17 |
17 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { | 18 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { |
(...skipping 27 matching lines...) Expand all Loading... |
45 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", | 46 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", |
46 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); | 47 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); |
47 } | 48 } |
48 | 49 |
49 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, | 50 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, |
50 HDCPState state) { | 51 HDCPState state) { |
51 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", | 52 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", |
52 output.display_id(), state); | 53 output.display_id(), state); |
53 } | 54 } |
54 | 55 |
| 56 std::string SetGammaRampAction(const ui::DisplaySnapshot& output, |
| 57 const std::vector<uint16_t>& r, |
| 58 const std::vector<uint16_t>& g, |
| 59 const std::vector<uint16_t>& b) { |
| 60 DCHECK_EQ(r.size(), g.size()); |
| 61 DCHECK_EQ(g.size(), b.size()); |
| 62 |
| 63 std::string table; |
| 64 for (size_t i = 0; i < r.size(); ++i) { |
| 65 table += base::StringPrintf(",rgb[%" PRIuS "]=%04x%04x%04x", i, r[i], g[i], |
| 66 b[i]); |
| 67 } |
| 68 |
| 69 return base::StringPrintf("set_gamma_ramp(id=%" PRId64 "%s)", |
| 70 output.display_id(), table.c_str()); |
| 71 } |
| 72 |
55 std::string JoinActions(const char* action, ...) { | 73 std::string JoinActions(const char* action, ...) { |
56 std::string actions; | 74 std::string actions; |
57 | 75 |
58 va_list arg_list; | 76 va_list arg_list; |
59 va_start(arg_list, action); | 77 va_start(arg_list, action); |
60 while (action) { | 78 while (action) { |
61 if (!actions.empty()) | 79 if (!actions.empty()) |
62 actions += ","; | 80 actions += ","; |
63 actions += action; | 81 actions += action; |
64 action = va_arg(arg_list, const char*); | 82 action = va_arg(arg_list, const char*); |
65 } | 83 } |
66 va_end(arg_list); | 84 va_end(arg_list); |
67 return actions; | 85 return actions; |
68 } | 86 } |
69 | 87 |
70 } // namespace test | 88 } // namespace test |
71 } // namespace ui | 89 } // namespace ui |
OLD | NEW |