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

Side by Side Diff: webkit/blob/local_file_stream_reader_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/blob/local_file_stream_reader.h" 5 #include "webkit/blob/local_file_stream_reader.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 13 #include "base/message_loop.h"
13 #include "base/platform_file.h" 14 #include "base/platform_file.h"
14 #include "base/scoped_temp_dir.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.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 namespace webkit_blob { 21 namespace webkit_blob {
22 22
23 namespace { 23 namespace {
24 24
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 void EnsureFileTaskFinished() { 112 void EnsureFileTaskFinished() {
113 file_task_runner()->PostTaskAndReply( 113 file_task_runner()->PostTaskAndReply(
114 FROM_HERE, base::Bind(&EmptyCallback), base::Bind(&QuitLoop)); 114 FROM_HERE, base::Bind(&EmptyCallback), base::Bind(&QuitLoop));
115 MessageLoop::current()->Run(); 115 MessageLoop::current()->Run();
116 } 116 }
117 117
118 private: 118 private:
119 MessageLoop message_loop_; 119 MessageLoop message_loop_;
120 base::Thread file_thread_; 120 base::Thread file_thread_;
121 ScopedTempDir dir_; 121 base::ScopedTempDir dir_;
122 base::Time test_file_modification_time_; 122 base::Time test_file_modification_time_;
123 }; 123 };
124 124
125 TEST_F(LocalFileStreamReaderTest, NonExistent) { 125 TEST_F(LocalFileStreamReaderTest, NonExistent) {
126 FilePath nonexistent_path = test_dir().AppendASCII("nonexistent"); 126 FilePath nonexistent_path = test_dir().AppendASCII("nonexistent");
127 scoped_ptr<LocalFileStreamReader> reader( 127 scoped_ptr<LocalFileStreamReader> reader(
128 CreateFileReader(nonexistent_path, 0, base::Time())); 128 CreateFileReader(nonexistent_path, 0, base::Time()));
129 int result = 0; 129 int result = 0;
130 std::string data; 130 std::string data;
131 ReadFromReader(reader.get(), &data, 10, &result); 131 ReadFromReader(reader.get(), &data, 10, &result);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); 252 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled));
253 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 253 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
254 254
255 // Delete immediately. 255 // Delete immediately.
256 // Should not crash; nor should NeverCalled be callback. 256 // Should not crash; nor should NeverCalled be callback.
257 reader.reset(); 257 reader.reset();
258 EnsureFileTaskFinished(); 258 EnsureFileTaskFinished();
259 } 259 }
260 260
261 } // namespace webkit_blob 261 } // namespace webkit_blob
OLDNEW
« no previous file with comments | « webkit/blob/blob_url_request_job_unittest.cc ('k') | webkit/blob/shareable_file_reference_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698