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

Side by Side Diff: chrome/browser/download/save_package_unittest.cc

Issue 351029: Support dragging a virtual file out of the browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/browser/gtk/download_item_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 5 #include <string>
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/download/save_package.h" 10 #include "chrome/browser/download/save_package.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 bool GetGeneratedFilename(bool need_success_generate_filename, 77 bool GetGeneratedFilename(bool need_success_generate_filename,
78 const std::string& disposition, 78 const std::string& disposition,
79 const std::string& url, 79 const std::string& url,
80 bool need_htm_ext, 80 bool need_htm_ext,
81 FilePath::StringType* generated_name) { 81 FilePath::StringType* generated_name) {
82 SavePackage* save_package; 82 SavePackage* save_package;
83 if (need_success_generate_filename) 83 if (need_success_generate_filename)
84 save_package = save_package_success_.get(); 84 save_package = save_package_success_.get();
85 else 85 else
86 save_package = save_package_fail_.get(); 86 save_package = save_package_fail_.get();
87 return save_package->GenerateFilename(disposition, GURL(url), need_htm_ext, 87 return save_package->GenerateFileName(disposition, GURL(url), need_htm_ext,
88 generated_name); 88 generated_name);
89 } 89 }
90 90
91 FilePath EnsureHtmlExtension(const FilePath& name) { 91 FilePath EnsureHtmlExtension(const FilePath& name) {
92 return SavePackage::EnsureHtmlExtension(name); 92 return SavePackage::EnsureHtmlExtension(name);
93 } 93 }
94 94
95 FilePath GetSuggestedNameForSaveAs(const FilePath& title, 95 FilePath GetSuggestedNameForSaveAs(const FilePath& title,
96 bool ensure_html_extension) { 96 bool ensure_html_extension) {
97 return SavePackage::GetSuggestedNameForSaveAs(title, ensure_html_extension); 97 return SavePackage::GetSuggestedNameForSaveAs(title, ensure_html_extension);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 TEST_F(SavePackageTest, TestSuggestedSaveNames) { 241 TEST_F(SavePackageTest, TestSuggestedSaveNames) {
242 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSuggestedSaveNames); ++i) { 242 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSuggestedSaveNames); ++i) {
243 FilePath title = FilePath(kSuggestedSaveNames[i].page_title); 243 FilePath title = FilePath(kSuggestedSaveNames[i].page_title);
244 FilePath save_name = 244 FilePath save_name =
245 GetSuggestedNameForSaveAs(title, 245 GetSuggestedNameForSaveAs(title,
246 kSuggestedSaveNames[i].ensure_html_extension); 246 kSuggestedSaveNames[i].ensure_html_extension);
247 EXPECT_EQ(save_name.value(), kSuggestedSaveNames[i].expected_name); 247 EXPECT_EQ(save_name.value(), kSuggestedSaveNames[i].expected_name);
248 } 248 }
249 } 249 }
250 250
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/browser/gtk/download_item_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698