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

Side by Side Diff: mojo/public/cpp/bindings/lib/validation_errors.h

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
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
7 7
8 #include "mojo/public/cpp/system/macros.h" 8 #include "mojo/public/cpp/system/macros.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 16 matching lines...) Expand all
27 VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER, 27 VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER,
28 // An array header doesn't make sense, for example: 28 // An array header doesn't make sense, for example:
29 // - |num_bytes| is smaller than the size of the header plus the size required 29 // - |num_bytes| is smaller than the size of the header plus the size required
30 // to store |num_elements| elements. 30 // to store |num_elements| elements.
31 VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER, 31 VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER,
32 // An encoded handle is illegal. 32 // An encoded handle is illegal.
33 VALIDATION_ERROR_ILLEGAL_HANDLE, 33 VALIDATION_ERROR_ILLEGAL_HANDLE,
34 // An encoded pointer is illegal. 34 // An encoded pointer is illegal.
35 VALIDATION_ERROR_ILLEGAL_POINTER, 35 VALIDATION_ERROR_ILLEGAL_POINTER,
36 // |flags| in the message header is an invalid flag combination. 36 // |flags| in the message header is an invalid flag combination.
37 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINAION, 37 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION,
38 // |flags| in the message header indicates that a request ID is required but 38 // |flags| in the message header indicates that a request ID is required but
39 // there isn't one. 39 // there isn't one.
40 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID, 40 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID,
41 }; 41 };
42 42
43 const char* ValidationErrorToString(ValidationError error); 43 const char* ValidationErrorToString(ValidationError error);
44 44
45 void ReportValidationError(ValidationError error); 45 void ReportValidationError(ValidationError error);
46 46
47 // Only used by validation tests and when there is only one thread doing message 47 // Only used by validation tests and when there is only one thread doing message
48 // validation. 48 // validation.
49 class ValidationErrorObserverForTesting { 49 class ValidationErrorObserverForTesting {
50 public: 50 public:
51 ValidationErrorObserverForTesting(); 51 ValidationErrorObserverForTesting();
52 ~ValidationErrorObserverForTesting(); 52 ~ValidationErrorObserverForTesting();
53 53
54 ValidationError last_error() const { return last_error_; } 54 ValidationError last_error() const { return last_error_; }
55 void set_last_error(ValidationError error) { last_error_ = error; } 55 void set_last_error(ValidationError error) { last_error_ = error; }
56 56
57 private: 57 private:
58 ValidationError last_error_; 58 ValidationError last_error_;
59 59
60 MOJO_DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting); 60 MOJO_DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting);
61 }; 61 };
62 62
63 } // namespace internal 63 } // namespace internal
64 } // namespace mojo 64 } // namespace mojo
65 65
66 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 66 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.cc ('k') | mojo/public/cpp/bindings/lib/validation_errors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698