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

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

Issue 9349005: net: Rename FileStream::Open/Close with OpenSync/CloseSync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 10 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
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 "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 bool OpenMockFileStream() { 115 bool OpenMockFileStream() {
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
117 117
118 FilePath path; 118 FilePath path;
119 if (!file_util::CreateTemporaryFile(&path)) 119 if (!file_util::CreateTemporaryFile(&path))
120 return false; 120 return false;
121 121
122 // Create a new file stream. 122 // Create a new file stream.
123 mock_file_stream_.reset(new net::testing::MockFileStream(NULL)); 123 mock_file_stream_.reset(new net::testing::MockFileStream(NULL));
124 if (mock_file_stream_->Open( 124 if (mock_file_stream_->OpenSync(
125 path, 125 path,
126 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE) != 0) { 126 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE) != 0) {
127 mock_file_stream_.reset(); 127 mock_file_stream_.reset();
128 return false; 128 return false;
129 } 129 }
130 130
131 return true; 131 return true;
132 } 132 }
133 133
134 void ForceError(net::Error error) { 134 void ForceError(net::Error error) {
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 base_file_->Finish(); 610 base_file_->Finish();
611 } 611 }
612 612
613 // Test that calculating speed after no delay - should not divide by 0. 613 // Test that calculating speed after no delay - should not divide by 0.
614 TEST_F(BaseFileTest, SpeedAfterNoElapsedTime) { 614 TEST_F(BaseFileTest, SpeedAfterNoElapsedTime) {
615 ASSERT_EQ(net::OK, base_file_->Initialize()); 615 ASSERT_EQ(net::OK, base_file_->Initialize());
616 ASSERT_EQ(net::OK, AppendDataToFile(kTestData1)); 616 ASSERT_EQ(net::OK, AppendDataToFile(kTestData1));
617 ASSERT_EQ(0, CurrentSpeedAtTime(StartTick())); 617 ASSERT_EQ(0, CurrentSpeedAtTime(StartTick()));
618 base_file_->Finish(); 618 base_file_->Finish();
619 } 619 }
OLDNEW
« no previous file with comments | « content/browser/download/base_file.cc ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698