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

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

Issue 299833008: Move AcceptWithResponder() out of the MessageReceiver interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 std::string result = func(&message); 90 std::string result = func(&message);
91 EXPECT_EQ(expected, result) << "failed test: " << root; 91 EXPECT_EQ(expected, result) << "failed test: " << root;
92 } 92 }
93 93
94 class DummyMessageReceiver : public MessageReceiver { 94 class DummyMessageReceiver : public MessageReceiver {
95 public: 95 public:
96 virtual bool Accept(Message* message) MOJO_OVERRIDE { 96 virtual bool Accept(Message* message) MOJO_OVERRIDE {
97 return true; // Any message is OK. 97 return true; // Any message is OK.
98 } 98 }
99 virtual bool AcceptWithResponder(Message* message,
100 MessageReceiver* responder) MOJO_OVERRIDE {
101 assert(false);
102 return false;
103 }
104 }; 99 };
105 100
106 std::string DumpMessageHeader(Message* message) { 101 std::string DumpMessageHeader(Message* message) {
107 DummyMessageReceiver not_reached_receiver; 102 DummyMessageReceiver not_reached_receiver;
108 internal::MessageHeaderValidator validator(&not_reached_receiver); 103 internal::MessageHeaderValidator validator(&not_reached_receiver);
109 bool rv = validator.Accept(message); 104 bool rv = validator.Accept(message);
110 if (!rv) 105 if (!rv)
111 return "ERROR\n"; 106 return "ERROR\n";
112 107
113 std::ostringstream os; 108 std::ostringstream os;
(...skipping 11 matching lines...) Expand all
125 std::vector<std::string> header_tests = 120 std::vector<std::string> header_tests =
126 GetMatchingTests(names, "validate_header_"); 121 GetMatchingTests(names, "validate_header_");
127 122
128 for (size_t i = 0; i < header_tests.size(); ++i) 123 for (size_t i = 0; i < header_tests.size(); ++i)
129 RunValidationTest(header_tests[i], &DumpMessageHeader); 124 RunValidationTest(header_tests[i], &DumpMessageHeader);
130 } 125 }
131 126
132 } // namespace 127 } // namespace
133 } // namespace test 128 } // namespace test
134 } // namespace mojo 129 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698