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

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: Merged to r180302 Created 7 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
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/test/data/History/history.21.sql » ('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) 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/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/history/download_row.h" 9 #include "chrome/browser/history/download_row.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.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 download_manager()->CreateDownloadItem( 146 download_manager()->CreateDownloadItem(
145 FilePath(FILE_PATH_LITERAL("/path/to/file")), 147 FilePath(FILE_PATH_LITERAL("/path/to/file")),
146 url, 148 FilePath(FILE_PATH_LITERAL("/path/to/file")),
149 url_chain,
147 GURL(""), 150 GURL(""),
148 current, 151 current,
149 current, 152 current,
150 128, 153 128,
151 128, 154 128,
152 content::DownloadItem::COMPLETE, 155 content::DownloadItem::COMPLETE,
156 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
157 content::DOWNLOAD_INTERRUPT_REASON_NONE,
153 false); 158 false);
154 159
155 mddh.WaitForDownloadsList(); 160 mddh.WaitForDownloadsList();
156 ASSERT_EQ(1, static_cast<int>(mddh.downloads_list()->GetSize())); 161 ASSERT_EQ(1, static_cast<int>(mddh.downloads_list()->GetSize()));
157 EXPECT_TRUE(ListMatches( 162 EXPECT_TRUE(ListMatches(
158 mddh.downloads_list(), 163 mddh.downloads_list(),
159 "[{\"file_externally_removed\": false," 164 "[{\"file_externally_removed\": false,"
160 " \"file_name\": \"file\"," 165 " \"file_name\": \"file\","
161 " \"id\": 0," 166 " \"id\": 0,"
162 " \"otr\": false," 167 " \"otr\": false,"
(...skipping 20 matching lines...) Expand all
183 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record 188 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record
184 // calls can't access off-record items. 189 // calls can't access off-record items.
185 190
186 // TODO(benjhayden): Test that bad download ids incoming from the javascript are 191 // TODO(benjhayden): Test that bad download ids incoming from the javascript are
187 // dropped on the floor. 192 // dropped on the floor.
188 193
189 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. 194 // TODO(benjhayden): Test that IsTemporary() downloads are not shown.
190 195
191 // TODO(benjhayden): Test that RemoveObserver is called on all download items, 196 // TODO(benjhayden): Test that RemoveObserver is called on all download items,
192 // including items that crossed IsTemporary() and back. 197 // including items that crossed IsTemporary() and back.
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/test/data/History/history.21.sql » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698