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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up year on licence text. 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) 2011 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"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 bool OpenMockFileStream() { 103 bool OpenMockFileStream() {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
105 105
106 FilePath path; 106 FilePath path;
107 if (!file_util::CreateTemporaryFile(&path)) 107 if (!file_util::CreateTemporaryFile(&path))
108 return false; 108 return false;
109 109
110 // Create a new file stream. 110 // Create a new file stream.
111 mock_file_stream_.reset(new net::testing::MockFileStream); 111 mock_file_stream_.reset(new net::testing::MockFileStream(NULL));
112 if (mock_file_stream_->Open( 112 if (mock_file_stream_->Open(
113 path, 113 path,
114 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE) != 0) { 114 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE) != 0) {
115 mock_file_stream_.reset(); 115 mock_file_stream_.reset();
116 return false; 116 return false;
117 } 117 }
118 118
119 return true; 119 return true;
120 } 120 }
121 121
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 base_file_->Finish(); 581 base_file_->Finish();
582 } 582 }
583 583
584 // Test that calculating speed after no delay - should not divide by 0. 584 // Test that calculating speed after no delay - should not divide by 0.
585 TEST_F(BaseFileTest, SpeedAfterNoElapsedTime) { 585 TEST_F(BaseFileTest, SpeedAfterNoElapsedTime) {
586 ASSERT_EQ(net::OK, base_file_->Initialize()); 586 ASSERT_EQ(net::OK, base_file_->Initialize());
587 ASSERT_EQ(net::OK, AppendDataToFile(kTestData1)); 587 ASSERT_EQ(net::OK, AppendDataToFile(kTestData1));
588 ASSERT_EQ(0, CurrentSpeedAtTime(StartTick())); 588 ASSERT_EQ(0, CurrentSpeedAtTime(StartTick()));
589 base_file_->Finish(); 589 base_file_->Finish();
590 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698