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

Side by Side Diff: content/browser/download/download_manager_impl_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 <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 // Test the behavior of DownloadFileManager and DownloadManager in the event 1004 // Test the behavior of DownloadFileManager and DownloadManager in the event
1005 // of a file error while writing the download to disk. 1005 // of a file error while writing the download to disk.
1006 TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) { 1006 TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) {
1007 // Create a temporary file and a mock stream. 1007 // Create a temporary file and a mock stream.
1008 FilePath path; 1008 FilePath path;
1009 ASSERT_TRUE(file_util::CreateTemporaryFile(&path)); 1009 ASSERT_TRUE(file_util::CreateTemporaryFile(&path));
1010 1010
1011 // This file stream will be used, until the first rename occurs. 1011 // This file stream will be used, until the first rename occurs.
1012 net::FileStream* stream = new net::FileStream(NULL); 1012 net::FileStream* stream = new net::FileStream(NULL);
1013 ASSERT_EQ(0, stream->Open( 1013 ASSERT_EQ(0, stream->OpenSync(
1014 path, 1014 path,
1015 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE)); 1015 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE));
1016 1016
1017 // Normally, the download system takes ownership of info, and is 1017 // Normally, the download system takes ownership of info, and is
1018 // responsible for deleting it. In these unit tests, however, we 1018 // responsible for deleting it. In these unit tests, however, we
1019 // don't call the function that deletes it, so we do so ourselves. 1019 // don't call the function that deletes it, so we do so ourselves.
1020 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo); 1020 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo);
1021 static const int32 local_id = 0; 1021 static const int32 local_id = 0;
1022 info->download_id = DownloadId(kValidIdDomain, local_id); 1022 info->download_id = DownloadId(kValidIdDomain, local_id);
1023 info->prompt_user_for_save_location = false; 1023 info->prompt_user_for_save_location = false;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); 1303 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED));
1304 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); 1304 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE));
1305 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); 1305 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING));
1306 EXPECT_TRUE(observer->was_updated()); 1306 EXPECT_TRUE(observer->was_updated());
1307 EXPECT_FALSE(observer->was_opened()); 1307 EXPECT_FALSE(observer->was_opened());
1308 EXPECT_TRUE(download->GetFileExternallyRemoved()); 1308 EXPECT_TRUE(download->GetFileExternallyRemoved());
1309 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 1309 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
1310 1310
1311 EXPECT_FALSE(file_util::PathExists(new_path)); 1311 EXPECT_FALSE(file_util::PathExists(new_path));
1312 } 1312 }
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