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

Side by Side Diff: mojo/system/dispatcher_unittest.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/dispatcher.cc ('k') | mojo/system/local_message_pipe_endpoint.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/dispatcher.h" 5 #include "mojo/system/dispatcher.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/threading/simple_thread.h" 11 #include "base/threading/simple_thread.h"
12 #include "mojo/system/waiter.h" 12 #include "mojo/system/waiter.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 namespace system { 16 namespace system {
17 namespace { 17 namespace {
18 18
19 // Trivial subclass that makes the constructor public. 19 // Trivial subclass that makes the constructor public.
20 class TrivialDispatcher : public Dispatcher { 20 class TrivialDispatcher : public Dispatcher {
21 public: 21 public:
22 TrivialDispatcher() {} 22 TrivialDispatcher() {}
23 23
24 private: 24 private:
25 friend class base::RefCountedThreadSafe<TrivialDispatcher>; 25 friend class base::RefCountedThreadSafe<TrivialDispatcher>;
26 virtual ~TrivialDispatcher() {} 26 virtual ~TrivialDispatcher() {}
27 27
28 virtual scoped_refptr<Dispatcher>
29 CreateEquivalentDispatcherAndCloseImplNoLock() OVERRIDE {
30 return scoped_refptr<Dispatcher>(new TrivialDispatcher());
31 }
32
28 DISALLOW_COPY_AND_ASSIGN(TrivialDispatcher); 33 DISALLOW_COPY_AND_ASSIGN(TrivialDispatcher);
29 }; 34 };
30 35
31 TEST(DispatcherTest, Basic) { 36 TEST(DispatcherTest, Basic) {
32 scoped_refptr<Dispatcher> d(new TrivialDispatcher()); 37 scoped_refptr<Dispatcher> d(new TrivialDispatcher());
33 38
34 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 39 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
35 d->WriteMessage(NULL, 0, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE)); 40 d->WriteMessage(NULL, 0, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE));
36 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 41 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
37 d->ReadMessage(NULL, NULL, 0, NULL, 42 d->ReadMessage(NULL, NULL, 0, NULL,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 event.Signal(); // Kicks off real work on the threads. 185 event.Signal(); // Kicks off real work on the threads.
181 } // Joins all the threads. 186 } // Joins all the threads.
182 187
183 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 188 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
184 } 189 }
185 } 190 }
186 191
187 } // namespace 192 } // namespace
188 } // namespace system 193 } // namespace system
189 } // namespace mojo 194 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/dispatcher.cc ('k') | mojo/system/local_message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698