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