OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 input.get_mutable_string_array().assign({ "hello", "world!" }); | 452 input.get_mutable_string_array().assign({ "hello", "world!" }); |
453 input.get_mutable_string_set().insert("hello"); | 453 input.get_mutable_string_set().insert("hello"); |
454 input.get_mutable_string_set().insert("world!"); | 454 input.get_mutable_string_set().insert("world!"); |
455 input.get_mutable_struct().value = 42; | 455 input.get_mutable_struct().value = 42; |
456 input.get_mutable_struct_array().resize(2); | 456 input.get_mutable_struct_array().resize(2); |
457 input.get_mutable_struct_array()[0].value = 1; | 457 input.get_mutable_struct_array()[0].value = 1; |
458 input.get_mutable_struct_array()[1].value = 2; | 458 input.get_mutable_struct_array()[1].value = 2; |
459 input.get_mutable_struct_map()["hello"] = NestedStructWithTraitsImpl(1024); | 459 input.get_mutable_struct_map()["hello"] = NestedStructWithTraitsImpl(1024); |
460 input.get_mutable_struct_map()["world"] = NestedStructWithTraitsImpl(2048); | 460 input.get_mutable_struct_map()["world"] = NestedStructWithTraitsImpl(2048); |
461 | 461 |
462 mojo::Array<uint8_t> data = StructWithTraits::Serialize(&input); | 462 auto data = StructWithTraits::Serialize(&input); |
463 StructWithTraitsImpl output; | 463 StructWithTraitsImpl output; |
464 ASSERT_TRUE(StructWithTraits::Deserialize(std::move(data), &output)); | 464 ASSERT_TRUE(StructWithTraits::Deserialize(std::move(data), &output)); |
465 | 465 |
466 EXPECT_EQ(input.get_enum(), output.get_enum()); | 466 EXPECT_EQ(input.get_enum(), output.get_enum()); |
467 EXPECT_EQ(input.get_bool(), output.get_bool()); | 467 EXPECT_EQ(input.get_bool(), output.get_bool()); |
468 EXPECT_EQ(input.get_uint32(), output.get_uint32()); | 468 EXPECT_EQ(input.get_uint32(), output.get_uint32()); |
469 EXPECT_EQ(input.get_uint64(), output.get_uint64()); | 469 EXPECT_EQ(input.get_uint64(), output.get_uint64()); |
470 EXPECT_EQ(input.get_string(), output.get_string()); | 470 EXPECT_EQ(input.get_string(), output.get_string()); |
471 EXPECT_EQ(input.get_string_array(), output.get_string_array()); | 471 EXPECT_EQ(input.get_string_array(), output.get_string_array()); |
472 EXPECT_EQ(input.get_string_set(), output.get_string_set()); | 472 EXPECT_EQ(input.get_string_set(), output.get_string_set()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 quit_closure.Run(); | 544 quit_closure.Run(); |
545 | 545 |
546 }, | 546 }, |
547 loop.QuitClosure())); | 547 loop.QuitClosure())); |
548 loop.Run(); | 548 loop.Run(); |
549 } | 549 } |
550 } | 550 } |
551 | 551 |
552 } // namespace test | 552 } // namespace test |
553 } // namespace mojo | 553 } // namespace mojo |
OLD | NEW |