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

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added test requested by reviewers. Created 8 years, 1 month 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 "base/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 }; 133 };
134 134
135 // Tests that DownloadsDOMHandler detects new downloads and relays them to the 135 // Tests that DownloadsDOMHandler detects new downloads and relays them to the
136 // renderer. 136 // renderer.
137 // crbug.com/159390: This test fails when daylight savings time ends. 137 // crbug.com/159390: This test fails when daylight savings time ends.
138 IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, 138 IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest,
139 DownloadsDOMHandlerTest_Created) { 139 DownloadsDOMHandlerTest_Created) {
140 MockDownloadsDOMHandler mddh(download_manager()); 140 MockDownloadsDOMHandler mddh(download_manager());
141 141
142 GURL url = test_server()->GetURL("files/downloads/image.jpg"); 142 GURL url = test_server()->GetURL("files/downloads/image.jpg");
143 std::vector<GURL> url_chain;
144 url_chain.push_back(url);
143 base::Time current(base::Time::Now()); 145 base::Time current(base::Time::Now());
144 content::DownloadPersistentStoreInfo population_entries[] = { 146 content::DownloadPersistentStoreInfo population_entries[] = {
145 content::DownloadPersistentStoreInfo( 147 content::DownloadPersistentStoreInfo(
146 FilePath(FILE_PATH_LITERAL("/path/to/file")), 148 FilePath(FILE_PATH_LITERAL("/path/to/file")),
147 url, 149 FilePath(FILE_PATH_LITERAL("/path/to/file")),
150 url_chain,
148 GURL(""), 151 GURL(""),
149 current - base::TimeDelta::FromMinutes(5), 152 current - base::TimeDelta::FromMinutes(5),
150 current, 153 current,
151 128, 154 128,
152 128, 155 128,
153 content::DownloadItem::COMPLETE, 156 content::DownloadItem::COMPLETE,
157 content::DOWNLOAD_INTERRUPT_REASON_NONE,
154 1, 158 1,
155 false), 159 false),
156 }; 160 };
157 std::vector<content::DownloadPersistentStoreInfo> entries( 161 std::vector<content::DownloadPersistentStoreInfo> entries(
158 population_entries, population_entries + arraysize(population_entries)); 162 population_entries, population_entries + arraysize(population_entries));
159 download_manager()->OnPersistentStoreQueryComplete(&entries); 163 download_manager()->OnPersistentStoreQueryComplete(&entries);
160 164
161 mddh.WaitForDownloadsList(); 165 mddh.WaitForDownloadsList();
162 ASSERT_EQ(1, static_cast<int>(mddh.downloads_list()->GetSize())); 166 ASSERT_EQ(1, static_cast<int>(mddh.downloads_list()->GetSize()));
163 EXPECT_TRUE(ListMatches( 167 EXPECT_TRUE(ListMatches(
(...skipping 25 matching lines...) Expand all
189 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record 193 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record
190 // calls can't access off-record items. 194 // calls can't access off-record items.
191 195
192 // TODO(benjhayden): Test that bad download ids incoming from the javascript are 196 // TODO(benjhayden): Test that bad download ids incoming from the javascript are
193 // dropped on the floor. 197 // dropped on the floor.
194 198
195 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. 199 // TODO(benjhayden): Test that IsTemporary() downloads are not shown.
196 200
197 // TODO(benjhayden): Test that RemoveObserver is called on all download items, 201 // TODO(benjhayden): Test that RemoveObserver is called on all download items,
198 // including items that crossed IsTemporary() and back. 202 // including items that crossed IsTemporary() and back.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698