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

Unified Diff: mojo/edk/system/simple_dispatcher_unittest.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/simple_dispatcher_unittest.cc
diff --git a/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc b/mojo/edk/system/simple_dispatcher_unittest.cc
similarity index 97%
copy from third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc
copy to mojo/edk/system/simple_dispatcher_unittest.cc
index 14cb5d8729c20c4b6818c408f071ce63163b9810..7d7b9c20afb9f4d7aaa0cd1c7e19847924487bdc 100644
--- a/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc
+++ b/mojo/edk/system/simple_dispatcher_unittest.cc
@@ -7,20 +7,20 @@
// increase tolerance and reduce observed flakiness (though doing so reduces the
// meaningfulness of the test).
-#include "third_party/mojo/src/mojo/edk/system/simple_dispatcher.h"
+#include "mojo/edk/system/simple_dispatcher.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
#include "base/synchronization/lock.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/edk/system/waiter_test_utils.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/edk/system/test_utils.h"
-#include "third_party/mojo/src/mojo/edk/system/waiter.h"
-#include "third_party/mojo/src/mojo/edk/system/waiter_test_utils.h"
namespace mojo {
-namespace system {
+namespace edk {
namespace {
class MockSimpleDispatcher final : public SimpleDispatcher {
@@ -28,11 +28,9 @@ class MockSimpleDispatcher final : public SimpleDispatcher {
MockSimpleDispatcher()
: state_(MOJO_HANDLE_SIGNAL_NONE,
MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE) {}
- explicit MockSimpleDispatcher(const HandleSignalsState& state)
- : state_(state) {}
void SetSatisfiedSignals(MojoHandleSignals new_satisfied_signals) {
- MutexLocker locker(&mutex());
+ base::AutoLock locker(lock());
// Any new signals that are set should be satisfiable.
CHECK_EQ(new_satisfied_signals & ~state_.satisfied_signals,
@@ -47,7 +45,7 @@ class MockSimpleDispatcher final : public SimpleDispatcher {
}
void SetSatisfiableSignals(MojoHandleSignals new_satisfiable_signals) {
- MutexLocker locker(&mutex());
+ base::AutoLock locker(lock());
// Satisfied implies satisfiable.
CHECK_EQ(new_satisfiable_signals & state_.satisfied_signals,
@@ -68,17 +66,19 @@ class MockSimpleDispatcher final : public SimpleDispatcher {
scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
override {
- scoped_refptr<MockSimpleDispatcher> rv(new MockSimpleDispatcher(state_));
+ scoped_refptr<MockSimpleDispatcher> rv(new MockSimpleDispatcher());
+ rv->state_ = state_;
return scoped_refptr<Dispatcher>(rv.get());
}
// |Dispatcher| override:
HandleSignalsState GetHandleSignalsStateImplNoLock() const override {
- mutex().AssertHeld();
+ lock().AssertAcquired();
return state_;
}
- HandleSignalsState state_ MOJO_GUARDED_BY(mutex());
+ // Protected by |lock()|:
+ HandleSignalsState state_;
MOJO_DISALLOW_COPY_AND_ASSIGN(MockSimpleDispatcher);
};
@@ -600,5 +600,5 @@ TEST(SimpleDispatcherTest, MAYBE_MultipleWaiters) {
// TODO(vtl): Stress test?
} // namespace
-} // namespace system
+} // namespace edk
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698