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 // Serialization warnings are only recorded in debug build. | 5 // Serialization warnings are only recorded in debug build. |
6 #ifndef NDEBUG | 6 #ifndef NDEBUG |
7 | 7 |
8 #include "mojo/public/cpp/bindings/array.h" | 8 #include "mojo/public/cpp/bindings/array.h" |
9 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 9 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
10 #include "mojo/public/cpp/bindings/lib/array_serialization.h" | 10 #include "mojo/public/cpp/bindings/lib/array_serialization.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 return array.Pass(); | 38 return array.Pass(); |
39 } | 39 } |
40 | 40 |
41 class SerializationWarningTest : public testing::Test { | 41 class SerializationWarningTest : public testing::Test { |
42 public: | 42 public: |
43 virtual ~SerializationWarningTest() {} | 43 virtual ~SerializationWarningTest() {} |
44 | 44 |
45 protected: | 45 protected: |
46 template <typename T> | 46 template <typename T> |
47 void TestWarning(T obj, mojo::internal::ValidationError expected_warning) { | 47 void TestWarning(StructPtr<T> obj, |
| 48 mojo::internal::ValidationError expected_warning) { |
48 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); | 49 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); |
49 | 50 |
50 mojo::internal::FixedBuffer buf(GetSerializedSize_(obj)); | 51 mojo::internal::FixedBuffer buf(GetSerializedSize_(obj)); |
51 typename T::Data_* data; | 52 typename T::Data_* data; |
52 Serialize_(obj.Pass(), &buf, &data); | 53 Serialize_(obj.Pass(), &buf, &data); |
53 | 54 |
54 EXPECT_EQ(expected_warning, warning_observer_.last_warning()); | 55 EXPECT_EQ(expected_warning, warning_observer_.last_warning()); |
55 } | 56 } |
56 | 57 |
57 template <typename ValidateParams, typename T> | 58 template <typename ValidateParams, typename T> |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 ArrayValidateParams<0, false, NoValidateParams>>>( | 214 ArrayValidateParams<0, false, NoValidateParams>>>( |
214 test_array.Pass(), | 215 test_array.Pass(), |
215 mojo::internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER); | 216 mojo::internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER); |
216 } | 217 } |
217 | 218 |
218 } // namespace | 219 } // namespace |
219 } // namespace test | 220 } // namespace test |
220 } // namespace mojo | 221 } // namespace mojo |
221 | 222 |
222 #endif | 223 #endif |
OLD | NEW |