Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: services/ui/public/cpp/tests/window_tree_client_unittest.cc

Issue 2511883006: Mojo C++ bindings: switch services/ui/public/interfaces mojom target to use STL types. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_private.cc ('k') | services/ui/public/cpp/window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/public/cpp/tests/window_tree_client_unittest.cc
diff --git a/services/ui/public/cpp/tests/window_tree_client_unittest.cc b/services/ui/public/cpp/tests/window_tree_client_unittest.cc
index 855ad7f1d3548fb016a743be17a45e42a9c6b1ea..2b899c411c2ee5c29ce36f25f911d72211de3810 100644
--- a/services/ui/public/cpp/tests/window_tree_client_unittest.cc
+++ b/services/ui/public/cpp/tests/window_tree_client_unittest.cc
@@ -40,13 +40,8 @@ Id server_id(ui::Window* window) {
} // namespace
-mojo::Array<uint8_t> Int32ToPropertyTransportValue(int32_t value) {
- const std::vector<uint8_t> bytes =
- mojo::ConvertTo<std::vector<uint8_t>>(value);
- mojo::Array<uint8_t> transport_value;
- transport_value.resize(bytes.size());
- memcpy(&transport_value.front(), &(bytes.front()), bytes.size());
- return transport_value;
+std::vector<uint8_t> Int32ToPropertyTransportValue(int32_t value) {
+ return mojo::ConvertTo<std::vector<uint8_t>>(value);
}
class TestWindowTreeClientDelegate : public WindowTreeClientDelegate {
@@ -779,8 +774,10 @@ TEST_F(WindowTreeClientTest, NewTopLevelWindowGetsAllChangesInFlight) {
data->window_id = server_id(root2);
data->bounds.SetRect(1, 2, 3, 4);
data->visible = true;
- data->properties["xx"] = mojo::Array<uint8_t>::From(std::string("server_xx"));
- data->properties["yy"] = mojo::Array<uint8_t>::From(std::string("server_yy"));
+ data->properties["xx"] =
+ mojo::Array<uint8_t>::From(std::string("server_xx")).PassStorage();
+ data->properties["yy"] =
+ mojo::Array<uint8_t>::From(std::string("server_yy")).PassStorage();
const int64_t display_id = 1;
setup.window_tree_client()->OnTopLevelCreated(
new_window_in_flight_change_id, std::move(data), display_id, true);
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_private.cc ('k') | services/ui/public/cpp/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698