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

Unified Diff: mojo/public/cpp/system/tests/watcher_unittest.cc

Issue 2540903002: Remove MessageLoop destruction observer from mojo::Watcher. (Closed)
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/android/system/watcher_impl.cc ('k') | mojo/public/cpp/system/watcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/system/tests/watcher_unittest.cc
diff --git a/mojo/public/cpp/system/tests/watcher_unittest.cc b/mojo/public/cpp/system/tests/watcher_unittest.cc
index 5cb3ed23b7799571da5820a1d81492791b8267f1..ebeebf6777888a67aeeba7af1b6bf0290cd2d312 100644
--- a/mojo/public/cpp/system/tests/watcher_unittest.cc
+++ b/mojo/public/cpp/system/tests/watcher_unittest.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -35,16 +36,10 @@ class WatcherTest : public testing::Test {
WatcherTest() {}
~WatcherTest() override {}
- void SetUp() override {
- message_loop_.reset(new base::MessageLoop);
- }
-
- void TearDown() override {
- message_loop_.reset();
- }
+ private:
+ base::MessageLoop message_loop_;
- protected:
- std::unique_ptr<base::MessageLoop> message_loop_;
+ DISALLOW_COPY_AND_ASSIGN(WatcherTest);
};
TEST_F(WatcherTest, WatchBasic) {
@@ -162,28 +157,6 @@ TEST_F(WatcherTest, CancelOnDestruction) {
run_loop.Run();
}
-TEST_F(WatcherTest, NotifyOnMessageLoopDestruction) {
- ScopedMessagePipeHandle a, b;
- CreateMessagePipe(nullptr, &a, &b);
-
- bool notified = false;
- Watcher b_watcher;
- EXPECT_EQ(MOJO_RESULT_OK,
- b_watcher.Start(b.get(), MOJO_HANDLE_SIGNAL_READABLE,
- OnReady([&] (MojoResult result) {
- EXPECT_EQ(MOJO_RESULT_ABORTED, result);
- notified = true;
- })));
- EXPECT_TRUE(b_watcher.IsWatching());
-
- message_loop_.reset();
-
- EXPECT_TRUE(notified);
-
- EXPECT_TRUE(b_watcher.IsWatching());
- b_watcher.Cancel();
-}
-
TEST_F(WatcherTest, CloseAndCancel) {
ScopedMessagePipeHandle a, b;
CreateMessagePipe(nullptr, &a, &b);
« no previous file with comments | « mojo/android/system/watcher_impl.cc ('k') | mojo/public/cpp/system/watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698