diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-10 23:17:12 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-10 23:17:12 +0000 |
commit | 517d8b4a4b51d75b58bd0def382a819f9e0d9306 (patch) | |
tree | a759cfdb95473e1f75345ebb48210e32a81f2c42 /mojo/common | |
parent | 1d9bdfa02acadf1bc3e63f62ee408bfe1f2fb589 (diff) | |
download | chromium_src-517d8b4a4b51d75b58bd0def382a819f9e0d9306.zip chromium_src-517d8b4a4b51d75b58bd0def382a819f9e0d9306.tar.gz chromium_src-517d8b4a4b51d75b58bd0def382a819f9e0d9306.tar.bz2 |
Mojo: Small cleanup of public/tests/test_support.h.
R=sky@chromium.org
Review URL: https://codereview.chromium.org/159303002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/common')
-rw-r--r-- | mojo/common/handle_watcher_unittest.cc | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/mojo/common/handle_watcher_unittest.cc b/mojo/common/handle_watcher_unittest.cc index b3ab76c..5d8c762 100644 --- a/mojo/common/handle_watcher_unittest.cc +++ b/mojo/common/handle_watcher_unittest.cc @@ -4,6 +4,8 @@ #include "mojo/common/handle_watcher.h" +#include <string> + #include "base/auto_reset.h" #include "base/bind.h" #include "base/run_loop.h" @@ -119,8 +121,8 @@ TEST_F(HandleWatcherTest, SingleHandler) { callback_helper.Start(&watcher, test_pipe.handle0.get()); RunUntilIdle(); EXPECT_FALSE(callback_helper.got_callback()); - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe.handle1.get(), + std::string())); callback_helper.RunUntilGotCallback(); EXPECT_TRUE(callback_helper.got_callback()); } @@ -160,8 +162,8 @@ TEST_F(HandleWatcherTest, ThreeHandles) { EXPECT_FALSE(callback_helper3.got_callback()); // Write to 3 and make sure it's notified. - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe3.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe3.handle1.get(), + std::string())); callback_helper3.RunUntilGotCallback(); EXPECT_FALSE(callback_helper1.got_callback()); EXPECT_FALSE(callback_helper2.got_callback()); @@ -170,10 +172,10 @@ TEST_F(HandleWatcherTest, ThreeHandles) { // Write to 1 and 3. Only 1 should be notified since 3 was is no longer // running. - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe1.handle1.get())); - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe3.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe1.handle1.get(), + std::string())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe3.handle1.get(), + std::string())); callback_helper1.RunUntilGotCallback(); EXPECT_TRUE(callback_helper1.got_callback()); EXPECT_FALSE(callback_helper2.got_callback()); @@ -181,10 +183,10 @@ TEST_F(HandleWatcherTest, ThreeHandles) { callback_helper1.clear_callback(); // Write to 1 and 2. Only 2 should be notified (since 1 was already notified). - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe1.handle1.get())); - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe2.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe1.handle1.get(), + std::string())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe2.handle1.get(), + std::string())); callback_helper2.RunUntilGotCallback(); EXPECT_FALSE(callback_helper1.got_callback()); EXPECT_TRUE(callback_helper2.got_callback()); @@ -213,18 +215,17 @@ TEST_F(HandleWatcherTest, Restart) { EXPECT_FALSE(callback_helper2.got_callback()); // Write to 1 and make sure it's notified. - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe1.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe1.handle1.get(), + std::string())); callback_helper1.RunUntilGotCallback(); EXPECT_TRUE(callback_helper1.got_callback()); EXPECT_FALSE(callback_helper2.got_callback()); callback_helper1.clear_callback(); - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::ReadEmptyMessage(test_pipe1.handle0.get())); + EXPECT_TRUE(mojo::test::DiscardMessage(test_pipe1.handle0.get())); // Write to 2 and make sure it's notified. - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe2.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe2.handle1.get(), + std::string())); callback_helper2.RunUntilGotCallback(); EXPECT_FALSE(callback_helper1.got_callback()); EXPECT_TRUE(callback_helper2.got_callback()); @@ -237,8 +238,8 @@ TEST_F(HandleWatcherTest, Restart) { EXPECT_FALSE(callback_helper2.got_callback()); // Write to 1 and make sure it's notified. - EXPECT_EQ(MOJO_RESULT_OK, - mojo::test::WriteEmptyMessage(test_pipe1.handle1.get())); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe1.handle1.get(), + std::string())); callback_helper1.RunUntilGotCallback(); EXPECT_TRUE(callback_helper1.got_callback()); EXPECT_FALSE(callback_helper2.got_callback()); @@ -297,7 +298,8 @@ TEST_F(HandleWatcherTest, DeleteInCallback) { base::Bind(&DeleteWatcherAndForwardResult, watcher, callback_helper.GetCallback())); - mojo::test::WriteEmptyMessage(test_pipe.handle0.get()); + EXPECT_TRUE(mojo::test::WriteTextMessage(test_pipe.handle0.get(), + std::string())); callback_helper.RunUntilGotCallback(); EXPECT_TRUE(callback_helper.got_callback()); } |