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

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

Issue 9317018: referrer_charset is a lie. It's really the user's default_charset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void set_prompt_user_for_save_location(bool value) { 108 void set_prompt_user_for_save_location(bool value) {
109 prompt_user_for_save_location_ = value; 109 prompt_user_for_save_location_ = value;
110 } 110 }
111 111
112 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE { 112 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE {
113 DownloadItem* item = download_manager_->GetActiveDownloadItem(download_id); 113 DownloadItem* item = download_manager_->GetActiveDownloadItem(download_id);
114 DownloadStateInfo state = item->GetStateInfo(); 114 DownloadStateInfo state = item->GetStateInfo();
115 FilePath path = net::GenerateFileName(item->GetURL(), 115 FilePath path = net::GenerateFileName(item->GetURL(),
116 item->GetContentDisposition(), 116 item->GetContentDisposition(),
117 item->GetReferrerCharset(), 117 item->GetDefaultCharset(),
118 item->GetSuggestedFilename(), 118 item->GetSuggestedFilename(),
119 item->GetMimeType(), 119 item->GetMimeType(),
120 std::string()); 120 std::string());
121 if (!ShouldOpenFileBasedOnExtension(path) && prompt_user_for_save_location_) 121 if (!ShouldOpenFileBasedOnExtension(path) && prompt_user_for_save_location_)
122 state.prompt_user_for_save_location = true; 122 state.prompt_user_for_save_location = true;
123 item->SetFileCheckResults(state); 123 item->SetFileCheckResults(state);
124 return true; 124 return true;
125 } 125 }
126 126
127 virtual FilePath GetIntermediatePath( 127 virtual FilePath GetIntermediatePath(
(...skipping 1175 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/download_manager_impl.cc ('k') | content/browser/download/download_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698