Chromium Code Reviews| 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((r.size() == g.size()) && (g.size() == b.size())); | |
|
oshima
2015/04/15 23:56:13
DCHECK_EQ(r.size(), g.size());
DCHECK_EQ(g.size(),
robert.bradford
2015/04/17 16:42:46
Done.
| |
| 61 | |
| 62 std::string table; | |
| 63 for (unsigned int i = 0; i < r.size(); ++i) { | |
|
oshima
2015/04/15 23:56:13
size_t
robert.bradford
2015/04/17 16:42:46
Done.
| |
| 64 table += base::StringPrintf(",rgb[%d]=%04x%04x%04x", i, r[i], g[i], b[i]); | |
| 65 } | |
|
oshima
2015/04/15 23:56:13
ditto
robert.bradford
2015/04/17 16:42:46
Done.
| |
| 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 |