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" |
| 12 #include "ui/display/types/gamma_ramp_rgb_entry.h" |
| 13 #include "ui/display/types/native_display_delegate.h" |
11 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
13 | 16 |
14 namespace ui { | 17 namespace ui { |
15 namespace test { | 18 namespace test { |
16 | 19 |
17 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { | 20 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { |
18 return base::StringPrintf("id=%" PRId64, output.display_id()); | 21 return base::StringPrintf("id=%" PRId64, output.display_id()); |
19 } | 22 } |
20 | 23 |
(...skipping 24 matching lines...) Expand all Loading... |
45 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", | 48 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", |
46 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); | 49 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); |
47 } | 50 } |
48 | 51 |
49 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, | 52 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, |
50 HDCPState state) { | 53 HDCPState state) { |
51 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", | 54 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", |
52 output.display_id(), state); | 55 output.display_id(), state); |
53 } | 56 } |
54 | 57 |
| 58 std::string SetGammaRampAction(const ui::DisplaySnapshot& output, |
| 59 const std::vector<GammaRampRGBEntry>& lut) { |
| 60 std::string table; |
| 61 for (size_t i = 0; i < lut.size(); ++i) { |
| 62 table += base::StringPrintf(",rgb[%" PRIuS "]=%04x%04x%04x", i, lut[i].r, |
| 63 lut[i].g, lut[i].b); |
| 64 } |
| 65 |
| 66 return base::StringPrintf("set_gamma_ramp(id=%" PRId64 "%s)", |
| 67 output.display_id(), table.c_str()); |
| 68 } |
| 69 |
55 std::string JoinActions(const char* action, ...) { | 70 std::string JoinActions(const char* action, ...) { |
56 std::string actions; | 71 std::string actions; |
57 | 72 |
58 va_list arg_list; | 73 va_list arg_list; |
59 va_start(arg_list, action); | 74 va_start(arg_list, action); |
60 while (action) { | 75 while (action) { |
61 if (!actions.empty()) | 76 if (!actions.empty()) |
62 actions += ","; | 77 actions += ","; |
63 actions += action; | 78 actions += action; |
64 action = va_arg(arg_list, const char*); | 79 action = va_arg(arg_list, const char*); |
65 } | 80 } |
66 va_end(arg_list); | 81 va_end(arg_list); |
67 return actions; | 82 return actions; |
68 } | 83 } |
69 | 84 |
70 } // namespace test | 85 } // namespace test |
71 } // namespace ui | 86 } // namespace ui |
OLD | NEW |