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

Unified Diff: net/base/file_stream_unittest.cc

Issue 149182: Merge r17560.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: Created 11 years, 6 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 | « net/base/file_stream_posix.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream_unittest.cc
===================================================================
--- net/base/file_stream_unittest.cc (revision 19709)
+++ net/base/file_stream_unittest.cc (working copy)
@@ -184,10 +184,14 @@
char buf[4];
rv = stream.Read(buf, arraysize(buf), &callback);
stream.Close();
- if (rv == net::ERR_IO_PENDING)
- rv = callback.WaitForResult();
- ASSERT_LE(0, rv);
- EXPECT_EQ(std::string(kTestData, rv), std::string(buf, rv));
+ if (rv < 0) {
+ EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ // The callback should not be called if the request is cancelled.
+ MessageLoop::current()->RunAllPending();
+ EXPECT_FALSE(callback.have_result());
+ } else {
+ EXPECT_EQ(std::string(kTestData, rv), std::string(buf, rv));
+ }
}
TEST_F(FileStreamTest, BasicRead_FromOffset) {
@@ -360,12 +364,16 @@
kTestDataSize - total_bytes_written,
&callback);
stream.Close();
- if (rv == net::ERR_IO_PENDING)
- rv = callback.WaitForResult();
- ASSERT_LT(0, rv);
- ok = file_util::GetFileSize(temp_file_path(), &file_size);
- EXPECT_TRUE(ok);
- EXPECT_EQ(file_size, rv);
+ if (rv < 0) {
+ EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ // The callback should not be called if the request is cancelled.
+ MessageLoop::current()->RunAllPending();
+ EXPECT_FALSE(callback.have_result());
+ } else {
+ ok = file_util::GetFileSize(temp_file_path(), &file_size);
+ EXPECT_TRUE(ok);
+ EXPECT_EQ(file_size, rv);
+ }
}
TEST_F(FileStreamTest, BasicWrite_FromOffset) {
Property changes on: net\base\file_stream_unittest.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/net/base/file_stream_unittest.cc:r14162,15308,16015,16808,17560
« no previous file with comments | « net/base/file_stream_posix.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698