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

Unified Diff: mojo/public/cpp/bindings/tests/map_unittest.cc

Issue 1358353002: * Change C++ serialization/deserialization to not be move-only operations (with the except of |Ha… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: (*it).get() to it->, and other formatting Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/map_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc
index 44100a41072fcbca6bd3c885b769b365402217b3..9a1525326ada98b2fb5112bead2df90012ea7af9 100644
--- a/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -6,6 +6,7 @@
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "mojo/public/cpp/bindings/lib/map_serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/map.h"
#include "mojo/public/cpp/bindings/string.h"
@@ -115,44 +116,6 @@ TEST_F(MapTest, ConstructedFromArray) {
}
}
-TEST_F(MapTest, DecomposeMapTo) {
- Array<String> keys(kStringIntDataSize);
- Array<int> values(kStringIntDataSize);
- for (size_t i = 0; i < kStringIntDataSize; ++i) {
- keys[i] = kStringIntData[i].string_data;
- values[i] = kStringIntData[i].int_data;
- }
-
- Map<String, int> map(keys.Pass(), values.Pass());
- EXPECT_EQ(kStringIntDataSize, map.size());
-
- Array<String> keys2;
- Array<int> values2;
- map.DecomposeMapTo(&keys2, &values2);
- EXPECT_EQ(0u, map.size());
-
- EXPECT_EQ(kStringIntDataSize, keys2.size());
- EXPECT_EQ(kStringIntDataSize, values2.size());
-
- for (size_t i = 0; i < kStringIntDataSize; ++i) {
- // We are not guaranteed that the copies have the same sorting as the
- // originals.
- String key = kStringIntData[i].string_data;
- int value = kStringIntData[i].int_data;
-
- bool found = false;
- for (size_t j = 0; j < keys2.size(); ++j) {
- if (keys2[j] == key) {
- EXPECT_EQ(value, values2[j]);
- found = true;
- break;
- }
- }
-
- EXPECT_TRUE(found);
- }
-}
-
TEST_F(MapTest, Insert_Copyable) {
ASSERT_EQ(0u, CopyableType::num_instances());
mojo::Map<mojo::String, CopyableType> map;
@@ -283,7 +246,7 @@ TEST_F(MapTest, ArrayOfMap) {
Array_Data<Map_Data<int32_t, int8_t>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(&array, &buf, &data, &validate_params);
Array<Map<int32_t, int8_t>> deserialized_array;
Deserialize_(data, &deserialized_array);
@@ -306,7 +269,7 @@ TEST_F(MapTest, ArrayOfMap) {
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(
0, false, new ArrayValidateParams(0, false, nullptr)));
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(&array, &buf, &data, &validate_params);
Array<Map<String, Array<bool>>> deserialized_array;
Deserialize_(data, &deserialized_array);
« no previous file with comments | « mojo/public/cpp/bindings/tests/array_unittest.cc ('k') | mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698