OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void DidWrite(base::File::Error status, int64_t bytes, bool complete) { | 132 void DidWrite(base::File::Error status, int64_t bytes, bool complete) { |
133 if (status == base::File::FILE_OK) { | 133 if (status == base::File::FILE_OK) { |
134 add_bytes_written(bytes, complete); | 134 add_bytes_written(bytes, complete); |
135 if (complete) | 135 if (complete) |
136 base::MessageLoop::current()->QuitWhenIdle(); | 136 base::MessageLoop::current()->QuitWhenIdle(); |
137 } else { | 137 } else { |
138 EXPECT_FALSE(complete_); | 138 EXPECT_FALSE(complete_); |
139 EXPECT_EQ(status_, base::File::FILE_OK); | 139 EXPECT_EQ(status_, base::File::FILE_OK); |
140 complete_ = true; | 140 complete_ = true; |
141 status_ = status; | 141 status_ = status; |
142 if (base::MessageLoop::current()->is_running()) | 142 if (base::RunLoop::IsRunningOnCurrentThread()) |
143 base::MessageLoop::current()->QuitWhenIdle(); | 143 base::MessageLoop::current()->QuitWhenIdle(); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 void DidCancel(base::File::Error status) { cancel_status_ = status; } | 147 void DidCancel(base::File::Error status) { cancel_status_ = status; } |
148 | 148 |
149 const MockBlobURLRequestContext& url_request_context() const { | 149 const MockBlobURLRequestContext& url_request_context() const { |
150 return *url_request_context_; | 150 return *url_request_context_; |
151 } | 151 } |
152 | 152 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); | 315 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); |
316 EXPECT_EQ(base::File::FILE_OK, cancel_status()); | 316 EXPECT_EQ(base::File::FILE_OK, cancel_status()); |
317 EXPECT_TRUE(complete()); | 317 EXPECT_TRUE(complete()); |
318 | 318 |
319 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); | 319 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); |
320 } | 320 } |
321 | 321 |
322 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. | 322 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. |
323 | 323 |
324 } // namespace content | 324 } // namespace content |
OLD | NEW |