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

Unified Diff: base/message_loop/message_loop_unittest.cc

Issue 593113004: Remove implicit HANDLE conversions from base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « base/files/file_win.cc ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop_unittest.cc
diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc
index 0a6e817f33f895022fff5a9b41fe14950f7ea8b9..b07ba0e0c791a1223495bab8ed792316fb535cae 100644
--- a/base/message_loop/message_loop_unittest.cc
+++ b/base/message_loop/message_loop_unittest.cc
@@ -333,7 +333,7 @@ void RunTest_RecursiveDenial2(MessageLoop::Type message_loop_type) {
&order,
false));
// Let the other thread execute.
- WaitForSingleObject(event, INFINITE);
+ WaitForSingleObject(event.Get(), INFINITE);
MessageLoop::current()->Run();
ASSERT_EQ(order.Size(), 17);
@@ -377,7 +377,7 @@ void RunTest_RecursiveSupport2(MessageLoop::Type message_loop_type) {
&order,
true));
// Let the other thread execute.
- WaitForSingleObject(event, INFINITE);
+ WaitForSingleObject(event.Get(), INFINITE);
MessageLoop::current()->Run();
ASSERT_EQ(order.Size(), 18);
@@ -517,10 +517,10 @@ TestIOHandler::TestIOHandler(const wchar_t* name, HANDLE signal, bool wait)
}
void TestIOHandler::Init() {
- MessageLoopForIO::current()->RegisterIOHandler(file_, this);
+ MessageLoopForIO::current()->RegisterIOHandler(file_.Get(), this);
DWORD read;
- EXPECT_FALSE(ReadFile(file_, buffer_, size(), &read, context()));
+ EXPECT_FALSE(ReadFile(file_.Get(), buffer_, size(), &read, context()));
EXPECT_EQ(ERROR_IO_PENDING, GetLastError());
if (wait_)
WaitForIO();
@@ -554,7 +554,7 @@ void RunTest_IOHandler() {
MessageLoop* thread_loop = thread.message_loop();
ASSERT_TRUE(NULL != thread_loop);
- TestIOHandler handler(kPipeName, callback_called, false);
+ TestIOHandler handler(kPipeName, callback_called.Get(), false);
thread_loop->PostTask(FROM_HERE, Bind(&TestIOHandler::Init,
Unretained(&handler)));
// Make sure the thread runs and sleeps for lack of work.
@@ -562,9 +562,9 @@ void RunTest_IOHandler() {
const char buffer[] = "Hello there!";
DWORD written;
- EXPECT_TRUE(WriteFile(server, buffer, sizeof(buffer), &written, NULL));
+ EXPECT_TRUE(WriteFile(server.Get(), buffer, sizeof(buffer), &written, NULL));
- DWORD result = WaitForSingleObject(callback_called, 1000);
+ DWORD result = WaitForSingleObject(callback_called.Get(), 1000);
EXPECT_EQ(WAIT_OBJECT_0, result);
thread.Stop();
@@ -595,8 +595,8 @@ void RunTest_WaitForIO() {
MessageLoop* thread_loop = thread.message_loop();
ASSERT_TRUE(NULL != thread_loop);
- TestIOHandler handler1(kPipeName1, callback1_called, false);
- TestIOHandler handler2(kPipeName2, callback2_called, true);
+ TestIOHandler handler1(kPipeName1, callback1_called.Get(), false);
+ TestIOHandler handler2(kPipeName2, callback2_called.Get(), true);
thread_loop->PostTask(FROM_HERE, Bind(&TestIOHandler::Init,
Unretained(&handler1)));
// TODO(ajwong): Do we really need such long Sleeps in ths function?
@@ -612,12 +612,12 @@ void RunTest_WaitForIO() {
const char buffer[] = "Hello there!";
DWORD written;
- EXPECT_TRUE(WriteFile(server1, buffer, sizeof(buffer), &written, NULL));
+ EXPECT_TRUE(WriteFile(server1.Get(), buffer, sizeof(buffer), &written, NULL));
PlatformThread::Sleep(2 * delay);
- EXPECT_EQ(WAIT_TIMEOUT, WaitForSingleObject(callback1_called, 0)) <<
+ EXPECT_EQ(WAIT_TIMEOUT, WaitForSingleObject(callback1_called.Get(), 0)) <<
"handler1 has not been called";
- EXPECT_TRUE(WriteFile(server2, buffer, sizeof(buffer), &written, NULL));
+ EXPECT_TRUE(WriteFile(server2.Get(), buffer, sizeof(buffer), &written, NULL));
HANDLE objects[2] = { callback1_called.Get(), callback2_called.Get() };
DWORD result = WaitForMultipleObjects(2, objects, TRUE, 1000);
« no previous file with comments | « base/files/file_win.cc ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698