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

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

Issue 1995643002: Mojo C++ bindings: fail validation test if no test data found and add data dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 message->mutable_handles()->resize(num_handles); 158 message->mutable_handles()->resize(num_handles);
159 159
160 return true; 160 return true;
161 } 161 }
162 162
163 void RunValidationTests(const std::string& prefix, 163 void RunValidationTests(const std::string& prefix,
164 MessageReceiver* test_message_receiver) { 164 MessageReceiver* test_message_receiver) {
165 std::vector<std::string> names = 165 std::vector<std::string> names =
166 EnumerateSourceRootRelativeDirectory(GetPath("", "")); 166 EnumerateSourceRootRelativeDirectory(GetPath("", ""));
167 std::vector<std::string> tests = GetMatchingTests(names, prefix); 167 std::vector<std::string> tests = GetMatchingTests(names, prefix);
168 ASSERT_FALSE(tests.empty());
168 169
169 for (size_t i = 0; i < tests.size(); ++i) { 170 for (size_t i = 0; i < tests.size(); ++i) {
170 Message message; 171 Message message;
171 std::string expected; 172 std::string expected;
172 ASSERT_TRUE(ReadTestCase(tests[i], &message, &expected)); 173 ASSERT_TRUE(ReadTestCase(tests[i], &message, &expected));
173 174
174 std::string result; 175 std::string result;
175 base::RunLoop run_loop; 176 base::RunLoop run_loop;
176 mojo::internal::ValidationErrorObserverForTesting observer( 177 mojo::internal::ValidationErrorObserverForTesting observer(
177 run_loop.QuitClosure()); 178 run_loop.QuitClosure());
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(0))); 490 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(0)));
490 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(1))); 491 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(1)));
491 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(2))); 492 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(2)));
492 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(3))); 493 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(3)));
493 EXPECT_FALSE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(4))); 494 EXPECT_FALSE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(4)));
494 } 495 }
495 496
496 } // namespace 497 } // namespace
497 } // namespace test 498 } // namespace test
498 } // namespace mojo 499 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698