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

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

Issue 11571025: Initial CL for Downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix try bot problems. Created 7 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
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 "chrome/browser/download/download_item_model.h" 5 #include "chrome/browser/download/download_item_model.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual ~DownloadItemModelTest() { 59 virtual ~DownloadItemModelTest() {
60 } 60 }
61 61
62 protected: 62 protected:
63 // Sets up defaults for the download item and sets |model_| to a new 63 // Sets up defaults for the download item and sets |model_| to a new
64 // DownloadItemModel that uses the mock download item. 64 // DownloadItemModel that uses the mock download item.
65 void SetupDownloadItemDefaults() { 65 void SetupDownloadItemDefaults() {
66 ON_CALL(item_, GetReceivedBytes()).WillByDefault(Return(1)); 66 ON_CALL(item_, GetReceivedBytes()).WillByDefault(Return(1));
67 ON_CALL(item_, GetTotalBytes()).WillByDefault(Return(2)); 67 ON_CALL(item_, GetTotalBytes()).WillByDefault(Return(2));
68 ON_CALL(item_, IsInProgress()).WillByDefault(Return(true)); 68 ON_CALL(item_, IsInProgress()).WillByDefault(Return(true));
69 ON_CALL(item_, CanResumeInterrupted()).WillByDefault(Return(false));
69 ON_CALL(item_, TimeRemaining(_)).WillByDefault(Return(false)); 70 ON_CALL(item_, TimeRemaining(_)).WillByDefault(Return(false));
70 ON_CALL(item_, GetMimeType()).WillByDefault(Return("text/html")); 71 ON_CALL(item_, GetMimeType()).WillByDefault(Return("text/html"));
71 ON_CALL(item_, AllDataSaved()).WillByDefault(Return(false)); 72 ON_CALL(item_, AllDataSaved()).WillByDefault(Return(false));
72 ON_CALL(item_, GetOpenWhenComplete()).WillByDefault(Return(false)); 73 ON_CALL(item_, GetOpenWhenComplete()).WillByDefault(Return(false));
73 ON_CALL(item_, GetFileExternallyRemoved()).WillByDefault(Return(false)); 74 ON_CALL(item_, GetFileExternallyRemoved()).WillByDefault(Return(false));
74 ON_CALL(item_, GetState()) 75 ON_CALL(item_, GetState())
75 .WillByDefault(Return(content::DownloadItem::IN_PROGRESS)); 76 .WillByDefault(Return(content::DownloadItem::IN_PROGRESS));
76 ON_CALL(item_, GetURL()) 77 ON_CALL(item_, GetURL())
77 .WillByDefault(ReturnRefOfCopy(GURL(kDefaultURL))); 78 .WillByDefault(ReturnRefOfCopy(GURL(kDefaultURL)));
78 ON_CALL(item_, GetFileNameToReportUser()) 79 ON_CALL(item_, GetFileNameToReportUser())
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 { content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, 134 { content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG,
134 "Failed - Path too long" }, 135 "Failed - Path too long" },
135 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE, 136 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE,
136 "Failed - File too large" }, 137 "Failed - File too large" },
137 { content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED, 138 { content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED,
138 "Failed - Virus detected" }, 139 "Failed - Virus detected" },
139 { content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, 140 { content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED,
140 "Failed - Blocked" }, 141 "Failed - Blocked" },
141 { content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED, 142 { content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED,
142 "Failed - Virus scan failed" }, 143 "Failed - Virus scan failed" },
144 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT,
145 "Failed - File truncated" },
143 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR, 146 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR,
144 "Failed - System busy" }, 147 "Failed - System busy" },
145 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, 148 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED,
146 "Failed - Network error" }, 149 "Failed - Network error" },
147 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, 150 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT,
148 "Failed - Network timeout" }, 151 "Failed - Network timeout" },
149 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, 152 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED,
150 "Failed - Network disconnected" }, 153 "Failed - Network disconnected" },
151 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN, 154 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN,
152 "Failed - Server unavailable" }, 155 "Failed - Server unavailable" },
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, 204 { content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG,
202 "foo.bar\nPath too long" }, 205 "foo.bar\nPath too long" },
203 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE, 206 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE,
204 "foo.bar\nFile too large" }, 207 "foo.bar\nFile too large" },
205 { content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED, 208 { content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED,
206 "foo.bar\nVirus detected" }, 209 "foo.bar\nVirus detected" },
207 { content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, 210 { content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED,
208 "foo.bar\nBlocked" }, 211 "foo.bar\nBlocked" },
209 { content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED, 212 { content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED,
210 "foo.bar\nVirus scan failed" }, 213 "foo.bar\nVirus scan failed" },
214 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT,
215 "foo.bar\nFile truncated" },
211 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR, 216 { content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR,
212 "foo.bar\nSystem busy" }, 217 "foo.bar\nSystem busy" },
213 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, 218 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED,
214 "foo.bar\nNetwork error" }, 219 "foo.bar\nNetwork error" },
215 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, 220 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT,
216 "foo.bar\nNetwork timeout" }, 221 "foo.bar\nNetwork timeout" },
217 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, 222 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED,
218 "foo.bar\nNetwork disconnected" }, 223 "foo.bar\nNetwork disconnected" },
219 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN, 224 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN,
220 "foo.bar\nServer unavailable" }, 225 "foo.bar\nServer unavailable" },
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // By default the download item should be displayable on the shelf. 351 // By default the download item should be displayable on the shelf.
347 EXPECT_TRUE(model().ShouldShowInShelf()); 352 EXPECT_TRUE(model().ShouldShowInShelf());
348 353
349 // Once explicitly set, ShouldShowInShelf() should return the explicit value. 354 // Once explicitly set, ShouldShowInShelf() should return the explicit value.
350 model().SetShouldShowInShelf(false); 355 model().SetShouldShowInShelf(false);
351 EXPECT_FALSE(model().ShouldShowInShelf()); 356 EXPECT_FALSE(model().ShouldShowInShelf());
352 357
353 model().SetShouldShowInShelf(true); 358 model().SetShouldShowInShelf(true);
354 EXPECT_TRUE(model().ShouldShowInShelf()); 359 EXPECT_TRUE(model().ShouldShowInShelf());
355 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698