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

Side by Side Diff: mojo/public/cpp/bindings/tests/struct_traits_unittest.cc

Issue 2604953003: Remove internal uses of mojo::Array and mojo::WTFArray. (Closed)
Patch Set: rebase Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/native_struct.h ('k') | mojo/public/cpp/bindings/tests/struct_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698