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 <stddef.h> | 8 #include <stddef.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 TestStructWarningImpl<T>(std::move(obj), expected_warning); | 56 TestStructWarningImpl<T>(std::move(obj), expected_warning); |
57 } | 57 } |
58 | 58 |
59 template <typename T, typename TPtr> | 59 template <typename T, typename TPtr> |
60 void TestStructWarningImpl(TPtr obj, | 60 void TestStructWarningImpl(TPtr obj, |
61 mojo::internal::ValidationError expected_warning) { | 61 mojo::internal::ValidationError expected_warning) { |
62 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); | 62 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); |
63 | 63 |
64 mojo::internal::SerializationContext context; | 64 mojo::internal::SerializationContext context; |
65 mojo::internal::FixedBufferForTesting buf( | 65 mojo::internal::FixedBufferForTesting buf( |
66 GetSerializedSize_(obj, &context)); | 66 mojo::internal::PrepareToSerialize<TPtr>(obj, &context)); |
67 typename T::Data_* data; | 67 typename T::Data_* data; |
68 Serialize_(std::move(obj), &buf, &data, &context); | 68 mojo::internal::Serialize<TPtr>(obj, &buf, &data, &context); |
69 | 69 |
70 EXPECT_EQ(expected_warning, warning_observer_.last_warning()); | 70 EXPECT_EQ(expected_warning, warning_observer_.last_warning()); |
71 } | 71 } |
72 | 72 |
73 template <typename T> | 73 template <typename T> |
74 void TestArrayWarning(T obj, | 74 void TestArrayWarning(T obj, |
75 mojo::internal::ValidationError expected_warning, | 75 mojo::internal::ValidationError expected_warning, |
76 const ArrayValidateParams* validate_params) { | 76 const ArrayValidateParams* validate_params) { |
77 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); | 77 warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); |
78 | 78 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 TestArrayWarning(std::move(test_array), | 227 TestArrayWarning(std::move(test_array), |
228 mojo::internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER, | 228 mojo::internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER, |
229 &validate_params_2); | 229 &validate_params_2); |
230 } | 230 } |
231 | 231 |
232 } // namespace | 232 } // namespace |
233 } // namespace test | 233 } // namespace test |
234 } // namespace mojo | 234 } // namespace mojo |
235 | 235 |
236 #endif | 236 #endif |
OLD | NEW |