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

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

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. 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_writer.h" 5 #include "storage/browser/fileapi/local_file_stream_writer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "net/base/io_buffer.h" 17 #include "net/base/io_buffer.h"
18 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 using storage::FileStreamWriter; 21 using storage::FileStreamWriter;
22 using storage::LocalFileStreamWriter; 22 using storage::LocalFileStreamWriter;
23 23
24 namespace content { 24 namespace content {
25 25
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return content; 70 return content;
71 } 71 }
72 72
73 base::FilePath CreateFileWithContent(const std::string& name, 73 base::FilePath CreateFileWithContent(const std::string& name,
74 const std::string& data) { 74 const std::string& data) {
75 base::FilePath path = Path(name); 75 base::FilePath path = Path(name);
76 base::WriteFile(path, data.c_str(), data.size()); 76 base::WriteFile(path, data.c_str(), data.size());
77 return path; 77 return path;
78 } 78 }
79 79
80 base::MessageLoopProxy* file_task_runner() const { 80 base::SingleThreadTaskRunner* file_task_runner() const {
81 return file_thread_.message_loop_proxy().get(); 81 return file_thread_.task_runner().get();
82 } 82 }
83 83
84 LocalFileStreamWriter* CreateWriter(const base::FilePath& path, 84 LocalFileStreamWriter* CreateWriter(const base::FilePath& path,
85 int64 offset) { 85 int64 offset) {
86 return new LocalFileStreamWriter(file_task_runner(), path, offset, 86 return new LocalFileStreamWriter(file_task_runner(), path, offset,
87 FileStreamWriter::OPEN_EXISTING_FILE); 87 FileStreamWriter::OPEN_EXISTING_FILE);
88 } 88 }
89 89
90 private: 90 private:
91 base::MessageLoopForIO message_loop_; 91 base::MessageLoopForIO message_loop_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); 171 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled));
172 ASSERT_EQ(net::ERR_IO_PENDING, result); 172 ASSERT_EQ(net::ERR_IO_PENDING, result);
173 173
174 net::TestCompletionCallback callback; 174 net::TestCompletionCallback callback;
175 writer->Cancel(callback.callback()); 175 writer->Cancel(callback.callback());
176 int cancel_result = callback.WaitForResult(); 176 int cancel_result = callback.WaitForResult();
177 EXPECT_EQ(net::OK, cancel_result); 177 EXPECT_EQ(net::OK, cancel_result);
178 } 178 }
179 179
180 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/local_file_stream_reader_unittest.cc ('k') | content/browser/fileapi/local_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698