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

Side by Side Diff: net/base/upload_data_stream_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
« no previous file with comments | « net/base/directory_lister_unittest.cc ('k') | net/base/upload_file_element_reader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/base/upload_data_stream.h" 5 #include "net/base/upload_data_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/scoped_temp_dir.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 16 #include "base/message_loop.h"
16 #include "base/scoped_temp_dir.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
19 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
20 #include "net/base/test_completion_callback.h" 20 #include "net/base/test_completion_callback.h"
21 #include "net/base/upload_data.h" 21 #include "net/base/upload_data.h"
22 #include "net/base/upload_file_element_reader.h" 22 #include "net/base/upload_file_element_reader.h"
23 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "testing/platform_test.h" 25 #include "testing/platform_test.h"
26 26
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 UploadDataStreamTest() : upload_data_(new UploadData) { } 131 UploadDataStreamTest() : upload_data_(new UploadData) { }
132 132
133 virtual void SetUp() OVERRIDE { 133 virtual void SetUp() OVERRIDE {
134 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 134 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
135 } 135 }
136 136
137 void FileChangedHelper(const FilePath& file_path, 137 void FileChangedHelper(const FilePath& file_path,
138 const base::Time& time, 138 const base::Time& time,
139 bool error_expected); 139 bool error_expected);
140 140
141 ScopedTempDir temp_dir_; 141 base::ScopedTempDir temp_dir_;
142 142
143 scoped_refptr<UploadData> upload_data_; 143 scoped_refptr<UploadData> upload_data_;
144 }; 144 };
145 145
146 TEST_F(UploadDataStreamTest, EmptyUploadData) { 146 TEST_F(UploadDataStreamTest, EmptyUploadData) {
147 upload_data_->AppendBytes("", 0); 147 upload_data_->AppendBytes("", 0);
148 UploadDataStream stream(upload_data_); 148 UploadDataStream stream(upload_data_);
149 ASSERT_EQ(OK, stream.InitSync()); 149 ASSERT_EQ(OK, stream.InitSync());
150 EXPECT_TRUE(stream.IsInMemory()); 150 EXPECT_TRUE(stream.IsInMemory());
151 EXPECT_EQ(0U, stream.size()); 151 EXPECT_EQ(0U, stream.size());
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 read_callback2.callback())); 700 read_callback2.callback()));
701 EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); 701 EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult());
702 EXPECT_EQ(expected_data, buf2); 702 EXPECT_EQ(expected_data, buf2);
703 EXPECT_TRUE(stream.IsEOF()); 703 EXPECT_TRUE(stream.IsEOF());
704 704
705 // Make sure callbacks are not called for cancelled operations. 705 // Make sure callbacks are not called for cancelled operations.
706 EXPECT_FALSE(read_callback1.have_result()); 706 EXPECT_FALSE(read_callback1.have_result());
707 } 707 }
708 708
709 } // namespace net 709 } // namespace net
OLDNEW
« no previous file with comments | « net/base/directory_lister_unittest.cc ('k') | net/base/upload_file_element_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698