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

Side by Side Diff: mojo/system/core_test_base.cc

Issue 66963005: Mojo: Implement local passing of MessagePipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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/system/core_impl_unittest.cc ('k') | mojo/system/dispatcher.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/system/core_test_base.h" 5 #include "mojo/system/core_test_base.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return MOJO_RESULT_RESOURCE_EXHAUSTED; 57 return MOJO_RESULT_RESOURCE_EXHAUSTED;
58 58
59 if (dispatchers) 59 if (dispatchers)
60 return MOJO_RESULT_UNIMPLEMENTED; 60 return MOJO_RESULT_UNIMPLEMENTED;
61 61
62 return MOJO_RESULT_OK; 62 return MOJO_RESULT_OK;
63 } 63 }
64 64
65 virtual MojoResult ReadMessageImplNoLock( 65 virtual MojoResult ReadMessageImplNoLock(
66 void* bytes, uint32_t* num_bytes, 66 void* bytes, uint32_t* num_bytes,
67 uint32_t /*max_num_dispatchers*/,
68 std::vector<scoped_refptr<Dispatcher> >* /*dispatchers*/, 67 std::vector<scoped_refptr<Dispatcher> >* /*dispatchers*/,
68 uint32_t* /*num_dispatchers*/,
69 MojoReadMessageFlags /*flags*/) OVERRIDE { 69 MojoReadMessageFlags /*flags*/) OVERRIDE {
70 info_->IncrementReadMessageCallCount(); 70 info_->IncrementReadMessageCallCount();
71 lock().AssertAcquired(); 71 lock().AssertAcquired();
72 72
73 if (num_bytes && !VerifyUserPointer<void>(bytes, *num_bytes)) 73 if (num_bytes && !VerifyUserPointer<void>(bytes, *num_bytes))
74 return MOJO_RESULT_INVALID_ARGUMENT; 74 return MOJO_RESULT_INVALID_ARGUMENT;
75 75
76 return MOJO_RESULT_OK; 76 return MOJO_RESULT_OK;
77 } 77 }
78 78
79 virtual MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/, 79 virtual MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/,
80 MojoWaitFlags /*flags*/, 80 MojoWaitFlags /*flags*/,
81 MojoResult /*wake_result*/) OVERRIDE { 81 MojoResult /*wake_result*/) OVERRIDE {
82 info_->IncrementAddWaiterCallCount(); 82 info_->IncrementAddWaiterCallCount();
83 lock().AssertAcquired(); 83 lock().AssertAcquired();
84 return MOJO_RESULT_FAILED_PRECONDITION; 84 return MOJO_RESULT_FAILED_PRECONDITION;
85 } 85 }
86 86
87 virtual void RemoveWaiterImplNoLock(Waiter* /*waiter*/) OVERRIDE { 87 virtual void RemoveWaiterImplNoLock(Waiter* /*waiter*/) OVERRIDE {
88 info_->IncrementRemoveWaiterCallCount(); 88 info_->IncrementRemoveWaiterCallCount();
89 lock().AssertAcquired(); 89 lock().AssertAcquired();
90 } 90 }
91 91
92 virtual void CancelAllWaitersNoLock() OVERRIDE { 92 virtual void CancelAllWaitersNoLock() OVERRIDE {
93 info_->IncrementCancelAllWaitersCallCount(); 93 info_->IncrementCancelAllWaitersCallCount();
94 lock().AssertAcquired(); 94 lock().AssertAcquired();
95 } 95 }
96 96
97 virtual scoped_refptr<Dispatcher>
98 CreateEquivalentDispatcherAndCloseImplNoLock() OVERRIDE {
99 return scoped_refptr<Dispatcher>(new MockDispatcher(info_));
100 }
101
97 CoreTestBase::MockHandleInfo* const info_; 102 CoreTestBase::MockHandleInfo* const info_;
98 103
99 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); 104 DISALLOW_COPY_AND_ASSIGN(MockDispatcher);
100 }; 105 };
101 106
102 } // namespace 107 } // namespace
103 108
104 // CoreTestBase ---------------------------------------------------------------- 109 // CoreTestBase ----------------------------------------------------------------
105 110
106 CoreTestBase::CoreTestBase() { 111 CoreTestBase::CoreTestBase() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 222 }
218 223
219 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { 224 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() {
220 base::AutoLock locker(lock_); 225 base::AutoLock locker(lock_);
221 cancel_all_waiters_call_count_++; 226 cancel_all_waiters_call_count_++;
222 } 227 }
223 228
224 } // namespace test 229 } // namespace test
225 } // namespace system 230 } // namespace system
226 } // namespace mojo 231 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/core_impl_unittest.cc ('k') | mojo/system/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698