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

Side by Side Diff: chrome/browser/download/base_file_unittest.cc

Issue 3348010: Revert 58196 - GTTF: Clean up DownloadFileManager... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/base_file.cc ('k') | chrome/browser/download/download_file.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/download/base_file.h" 9 #include "chrome/browser/download/base_file.h"
10 #include "net/base/file_stream.h" 10 #include "net/base/file_stream.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace { 13 namespace {
14 14
15 const char kTestData1[] = "Let's write some data to the file!\n"; 15 const char kTestData1[] = "Let's write some data to the file!\n";
16 const char kTestData2[] = "Writing more data.\n"; 16 const char kTestData2[] = "Writing more data.\n";
17 const char kTestData3[] = "Final line."; 17 const char kTestData3[] = "Final line.";
18 18
19 class BaseFileTest : public testing::Test { 19 class BaseFileTest : public testing::Test {
20 public: 20 public:
21 BaseFileTest() : file_thread_(ChromeThread::FILE, &message_loop_) { 21 BaseFileTest() : file_thread_(ChromeThread::FILE, &message_loop_) {
22 } 22 }
23 23
24 virtual void SetUp() { 24 virtual void SetUp() {
25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
26 base_file_.reset(new BaseFile(FilePath(), GURL(), GURL(), 0, file_stream_)); 26 base_file_.reset(new BaseFile(FilePath(), GURL(), GURL(), file_stream_));
27 } 27 }
28 28
29 virtual void TearDown() { 29 virtual void TearDown() {
30 EXPECT_FALSE(base_file_->in_progress()); 30 EXPECT_FALSE(base_file_->in_progress());
31 EXPECT_EQ(static_cast<int64>(expected_data_.size()), 31 EXPECT_EQ(static_cast<int64>(expected_data_.size()),
32 base_file_->bytes_so_far()); 32 base_file_->bytes_so_far());
33 33
34 if (!expected_data_.empty()) { 34 if (!expected_data_.empty()) {
35 // Make sure the data has been properly written to disk. 35 // Make sure the data has been properly written to disk.
36 std::string disk_data; 36 std::string disk_data;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 EXPECT_TRUE(file_util::PathExists(new_path)); 145 EXPECT_TRUE(file_util::PathExists(new_path));
146 146
147 AppendDataToFile(kTestData2); 147 AppendDataToFile(kTestData2);
148 148
149 base_file_->Finish(); 149 base_file_->Finish();
150 150
151 EXPECT_TRUE(base_file_->path_renamed()); 151 EXPECT_TRUE(base_file_->path_renamed());
152 } 152 }
153 153
154 } // namespace 154 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/base_file.cc ('k') | chrome/browser/download/download_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698