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

Side by Side Diff: mojo/public/cpp/bindings/lib/message_header_validator.cc

Issue 322003002: Mojo message validation tests: add integration tests and move existing conformance tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « mojo/mojo_public.gypi ('k') | mojo/public/cpp/bindings/lib/router.h » ('j') | 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 "mojo/public/cpp/bindings/lib/message_header_validator.h" 5 #include "mojo/public/cpp/bindings/lib/message_header_validator.h"
6 6
7 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" 7 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
8 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" 8 #include "mojo/public/cpp/bindings/lib/bounds_checker.h"
9 #include "mojo/public/cpp/bindings/lib/validation_errors.h" 9 #include "mojo/public/cpp/bindings/lib/validation_errors.h"
10 10
(...skipping 30 matching lines...) Expand all
41 ((header->flags & kMessageExpectsResponse) || 41 ((header->flags & kMessageExpectsResponse) ||
42 (header->flags & kMessageIsResponse))) { 42 (header->flags & kMessageIsResponse))) {
43 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID); 43 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID);
44 return false; 44 return false;
45 } 45 }
46 46
47 // These flags are mutually exclusive. 47 // These flags are mutually exclusive.
48 if ((header->flags & kMessageExpectsResponse) && 48 if ((header->flags & kMessageExpectsResponse) &&
49 (header->flags & kMessageIsResponse)) { 49 (header->flags & kMessageIsResponse)) {
50 ReportValidationError( 50 ReportValidationError(
51 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINAION); 51 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION);
52 return false; 52 return false;
53 } 53 }
54 54
55 return true; 55 return true;
56 } 56 }
57 57
58 } // namespace 58 } // namespace
59 59
60 MessageHeaderValidator::MessageHeaderValidator(MessageReceiver* sink) 60 MessageHeaderValidator::MessageHeaderValidator(MessageReceiver* sink)
61 : MessageFilter(sink) { 61 : MessageFilter(sink) {
(...skipping 10 matching lines...) Expand all
72 } 72 }
73 73
74 if (!IsValidMessageHeader(message->header())) 74 if (!IsValidMessageHeader(message->header()))
75 return false; 75 return false;
76 76
77 return sink_->Accept(message); 77 return sink_->Accept(message);
78 } 78 }
79 79
80 } // namespace internal 80 } // namespace internal
81 } // namespace mojo 81 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo_public.gypi ('k') | mojo/public/cpp/bindings/lib/router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698