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

Side by Side Diff: content/browser/fileapi/local_file_stream_reader_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "storage/browser/fileapi/local_file_stream_reader.h" 5 #include "storage/browser/fileapi/local_file_stream_reader.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/location.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/run_loop.h" 14 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h"
17 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
18 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
19 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
20 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
21 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
22 20
23 using storage::LocalFileStreamReader; 21 using storage::LocalFileStreamReader;
24 22
25 namespace content { 23 namespace content {
26 24
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 94 }
97 95
98 void TouchTestFile() { 96 void TouchTestFile() {
99 base::Time new_modified_time = 97 base::Time new_modified_time =
100 test_file_modification_time() - base::TimeDelta::FromSeconds(1); 98 test_file_modification_time() - base::TimeDelta::FromSeconds(1);
101 ASSERT_TRUE(base::TouchFile(test_path(), 99 ASSERT_TRUE(base::TouchFile(test_path(),
102 test_file_modification_time(), 100 test_file_modification_time(),
103 new_modified_time)); 101 new_modified_time));
104 } 102 }
105 103
106 base::SingleThreadTaskRunner* file_task_runner() const { 104 base::MessageLoopProxy* file_task_runner() const {
107 return file_thread_.task_runner().get(); 105 return file_thread_.message_loop_proxy().get();
108 } 106 }
109 107
110 base::FilePath test_dir() const { return dir_.path(); } 108 base::FilePath test_dir() const { return dir_.path(); }
111 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); } 109 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); }
112 base::Time test_file_modification_time() const { 110 base::Time test_file_modification_time() const {
113 return test_file_modification_time_; 111 return test_file_modification_time_;
114 } 112 }
115 113
116 void EnsureFileTaskFinished() { 114 void EnsureFileTaskFinished() {
117 file_task_runner()->PostTaskAndReply( 115 file_task_runner()->PostTaskAndReply(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); 249 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled));
252 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 250 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
253 251
254 // Delete immediately. 252 // Delete immediately.
255 // Should not crash; nor should NeverCalled be callback. 253 // Should not crash; nor should NeverCalled be callback.
256 reader.reset(); 254 reader.reset();
257 EnsureFileTaskFinished(); 255 EnsureFileTaskFinished();
258 } 256 }
259 257
260 } // namespace content 258 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_writer_delegate_unittest.cc ('k') | content/browser/fileapi/local_file_stream_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698