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

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

Issue 16522: Unbreak unit tests. Revert r7564. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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/download_manager.cc ('k') | chrome/browser/download/download_util.cc » ('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/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/download/download_manager.h" 8 #include "chrome/browser/download/download_manager.h"
9 #include "chrome/browser/download/download_util.h" 9 #include "chrome/browser/download/download_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 class DownloadManagerTest : public testing::Test { 12 class DownloadManagerTest : public testing::Test {
13 public: 13 public:
14 DownloadManagerTest() { 14 DownloadManagerTest() {
15 download_manager_ = new DownloadManager(); 15 download_manager_ = new DownloadManager();
16 download_util::InitializeExeTypes(&download_manager_->exe_types_); 16 download_util::InitializeExeTypes(&download_manager_->exe_types_);
17 } 17 }
18 18
19 void GetGeneratedFilename(const std::string& content_disposition, 19 void GetGeneratedFilename(const std::string& content_disposition,
20 const std::wstring& url, 20 const std::wstring& url,
21 const std::string& mime_type, 21 const std::string& mime_type,
22 std::wstring* generated_name_string) { 22 std::wstring* generated_name) {
23 DownloadCreateInfo info; 23 DownloadCreateInfo info;
24 info.content_disposition = content_disposition; 24 info.content_disposition = content_disposition;
25 info.url = url; 25 info.url = url;
26 info.mime_type = mime_type; 26 info.mime_type = mime_type;
27 FilePath generated_name; 27 download_manager_->GenerateFilename(&info, generated_name);
28 download_manager_->GenerateFilename(&info, &generated_name);
29 *generated_name_string = generated_name.ToWStringHack();
30 } 28 }
31 29
32 protected: 30 protected:
33 scoped_refptr<DownloadManager> download_manager_; 31 scoped_refptr<DownloadManager> download_manager_;
34 MessageLoopForUI message_loop_; 32 MessageLoopForUI message_loop_;
35 33
36 DISALLOW_EVIL_CONSTRUCTORS(DownloadManagerTest); 34 DISALLOW_EVIL_CONSTRUCTORS(DownloadManagerTest);
37 }; 35 };
38 36
39 static const struct { 37 static const struct {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 for (int i = 0; i < arraysize(kGeneratedFiles); ++i) { 316 for (int i = 0; i < arraysize(kGeneratedFiles); ++i) {
319 std::wstring file_name; 317 std::wstring file_name;
320 GetGeneratedFilename(kGeneratedFiles[i].disposition, 318 GetGeneratedFilename(kGeneratedFiles[i].disposition,
321 kGeneratedFiles[i].url, 319 kGeneratedFiles[i].url,
322 kGeneratedFiles[i].mime_type, 320 kGeneratedFiles[i].mime_type,
323 &file_name); 321 &file_name);
324 EXPECT_EQ(kGeneratedFiles[i].expected_name, file_name); 322 EXPECT_EQ(kGeneratedFiles[i].expected_name, file_name);
325 } 323 }
326 } 324 }
327 325
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698