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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright issue. 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } 1003 }
1004 1004
1005 // Test the behavior of DownloadFileManager and DownloadManager in the event 1005 // Test the behavior of DownloadFileManager and DownloadManager in the event
1006 // of a file error while writing the download to disk. 1006 // of a file error while writing the download to disk.
1007 TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) { 1007 TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) {
1008 // Create a temporary file and a mock stream. 1008 // Create a temporary file and a mock stream.
1009 FilePath path; 1009 FilePath path;
1010 ASSERT_TRUE(file_util::CreateTemporaryFile(&path)); 1010 ASSERT_TRUE(file_util::CreateTemporaryFile(&path));
1011 1011
1012 // This file stream will be used, until the first rename occurs. 1012 // This file stream will be used, until the first rename occurs.
1013 net::FileStream* stream = new net::FileStream; 1013 net::FileStream* stream = new net::FileStream(NULL);
1014 ASSERT_EQ(0, stream->Open( 1014 ASSERT_EQ(0, stream->Open(
1015 path, 1015 path,
1016 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE)); 1016 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE));
1017 1017
1018 // Normally, the download system takes ownership of info, and is 1018 // Normally, the download system takes ownership of info, and is
1019 // responsible for deleting it. In these unit tests, however, we 1019 // responsible for deleting it. In these unit tests, however, we
1020 // don't call the function that deletes it, so we do so ourselves. 1020 // don't call the function that deletes it, so we do so ourselves.
1021 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo); 1021 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo);
1022 static const int32 local_id = 0; 1022 static const int32 local_id = 0;
1023 info->download_id = DownloadId(kValidIdDomain, local_id); 1023 info->download_id = DownloadId(kValidIdDomain, local_id);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); 1304 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED));
1305 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); 1305 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE));
1306 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); 1306 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING));
1307 EXPECT_TRUE(observer->was_updated()); 1307 EXPECT_TRUE(observer->was_updated());
1308 EXPECT_FALSE(observer->was_opened()); 1308 EXPECT_FALSE(observer->was_opened());
1309 EXPECT_TRUE(download->GetFileExternallyRemoved()); 1309 EXPECT_TRUE(download->GetFileExternallyRemoved());
1310 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 1310 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
1311 1311
1312 EXPECT_FALSE(file_util::PathExists(new_path)); 1312 EXPECT_FALSE(file_util::PathExists(new_path));
1313 } 1313 }
OLDNEW
« no previous file with comments | « content/browser/download/base_file_unittest.cc ('k') | content/browser/download/drag_download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698