OLD | NEW |
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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 namespace { | 88 namespace { |
89 | 89 |
90 // IDs and paths of CRX files used in tests. | 90 // IDs and paths of CRX files used in tests. |
91 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; | 91 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; |
92 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); | 92 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); |
93 | 93 |
94 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; | 94 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; |
95 const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); | 95 const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); |
96 | 96 |
| 97 // Get History Information. |
| 98 class DownloadsHistoryDataCollector { |
| 99 public: |
| 100 explicit DownloadsHistoryDataCollector(Profile* profile) |
| 101 : profile_(profile), result_valid_(false) {} |
| 102 |
| 103 bool WaitForDownloadInfo( |
| 104 scoped_ptr<std::vector<history::DownloadRow> >* results) { |
| 105 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 106 profile_, Profile::EXPLICIT_ACCESS); |
| 107 DCHECK(hs); |
| 108 hs->QueryDownloads( |
| 109 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, |
| 110 base::Unretained(this))); |
| 111 |
| 112 content::RunMessageLoop(); |
| 113 if (result_valid_) { |
| 114 *results = results_.Pass(); |
| 115 } |
| 116 return result_valid_; |
| 117 } |
| 118 |
| 119 private: |
| 120 void OnQueryDownloadsComplete( |
| 121 scoped_ptr<std::vector<history::DownloadRow> > entries) { |
| 122 result_valid_ = true; |
| 123 results_ = entries.Pass(); |
| 124 MessageLoopForUI::current()->Quit(); |
| 125 } |
| 126 |
| 127 Profile* profile_; |
| 128 scoped_ptr<std::vector<history::DownloadRow> > results_; |
| 129 bool result_valid_; |
| 130 CancelableRequestConsumer callback_consumer_; |
| 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(DownloadsHistoryDataCollector); |
| 133 }; |
| 134 |
97 // Mock that simulates a permissions dialog where the user denies | 135 // Mock that simulates a permissions dialog where the user denies |
98 // permission to install. TODO(skerner): This could be shared with | 136 // permission to install. TODO(skerner): This could be shared with |
99 // extensions tests. Find a common place for this class. | 137 // extensions tests. Find a common place for this class. |
100 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { | 138 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { |
101 public: | 139 public: |
102 MockAbortExtensionInstallPrompt() : | 140 MockAbortExtensionInstallPrompt() : |
103 ExtensionInstallPrompt(NULL) { | 141 ExtensionInstallPrompt(NULL) { |
104 } | 142 } |
105 | 143 |
106 // Simulate a user abort on an extension installation. | 144 // Simulate a user abort on an extension installation. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 196 |
159 bool WasAutoOpened(DownloadItem* item) { | 197 bool WasAutoOpened(DownloadItem* item) { |
160 return item->GetAutoOpened(); | 198 return item->GetAutoOpened(); |
161 } | 199 } |
162 | 200 |
163 // Called when a download starts. Marks the download as hidden. | 201 // Called when a download starts. Marks the download as hidden. |
164 void SetHiddenDownloadCallback(DownloadItem* item, net::Error error) { | 202 void SetHiddenDownloadCallback(DownloadItem* item, net::Error error) { |
165 DownloadItemModel(item).SetShouldShowInShelf(false); | 203 DownloadItemModel(item).SetShouldShowInShelf(false); |
166 } | 204 } |
167 | 205 |
| 206 // Callback for HistoryObserver; used in DownloadHistoryCheck |
| 207 bool HasDataAndName(const history::DownloadRow& row) { |
| 208 return row.received_bytes > 0 && !row.target_path.empty(); |
| 209 } |
| 210 |
168 } // namespace | 211 } // namespace |
169 | 212 |
170 // While an object of this class exists, it will mock out download | 213 // While an object of this class exists, it will mock out download |
171 // opening for all downloads created on the specified download manager. | 214 // opening for all downloads created on the specified download manager. |
172 class MockDownloadOpeningObserver : public DownloadManager::Observer { | 215 class MockDownloadOpeningObserver : public DownloadManager::Observer { |
173 public: | 216 public: |
174 explicit MockDownloadOpeningObserver(DownloadManager* manager) | 217 explicit MockDownloadOpeningObserver(DownloadManager* manager) |
175 : download_manager_(manager) { | 218 : download_manager_(manager) { |
176 download_manager_->AddObserver(this); | 219 download_manager_->AddObserver(this); |
177 } | 220 } |
178 | 221 |
179 ~MockDownloadOpeningObserver() { | 222 ~MockDownloadOpeningObserver() { |
180 download_manager_->RemoveObserver(this); | 223 download_manager_->RemoveObserver(this); |
181 } | 224 } |
182 | 225 |
183 virtual void OnDownloadCreated( | 226 virtual void OnDownloadCreated( |
184 DownloadManager* manager, DownloadItem* item) OVERRIDE { | 227 DownloadManager* manager, DownloadItem* item) OVERRIDE { |
185 item->MockDownloadOpenForTesting(); | 228 item->MockDownloadOpenForTesting(); |
186 } | 229 } |
187 | 230 |
188 private: | 231 private: |
189 DownloadManager* download_manager_; | 232 DownloadManager* download_manager_; |
190 | 233 |
191 DISALLOW_COPY_AND_ASSIGN(MockDownloadOpeningObserver); | 234 DISALLOW_COPY_AND_ASSIGN(MockDownloadOpeningObserver); |
192 }; | 235 }; |
193 | 236 |
194 class HistoryObserver : public DownloadHistory::Observer { | 237 class HistoryObserver : public DownloadHistory::Observer { |
195 public: | 238 public: |
| 239 typedef base::Callback<bool(const history::DownloadRow&)> FilterCallback; |
| 240 |
196 explicit HistoryObserver(Profile* profile) | 241 explicit HistoryObserver(Profile* profile) |
197 : profile_(profile), | 242 : profile_(profile), |
198 waiting_(false), | 243 waiting_(false), |
199 seen_stored_(false) { | 244 seen_stored_(false) { |
200 DownloadServiceFactory::GetForProfile(profile_)-> | 245 DownloadServiceFactory::GetForProfile(profile_)-> |
201 GetDownloadHistory()->AddObserver(this); | 246 GetDownloadHistory()->AddObserver(this); |
202 } | 247 } |
203 | 248 |
204 virtual ~HistoryObserver() { | 249 virtual ~HistoryObserver() { |
205 DownloadService* service = DownloadServiceFactory::GetForProfile(profile_); | 250 DownloadService* service = DownloadServiceFactory::GetForProfile(profile_); |
206 if (service && service->GetDownloadHistory()) | 251 if (service && service->GetDownloadHistory()) |
207 service->GetDownloadHistory()->RemoveObserver(this); | 252 service->GetDownloadHistory()->RemoveObserver(this); |
208 } | 253 } |
209 | 254 |
| 255 void SetFilterCallback(const FilterCallback& callback) { |
| 256 callback_ = callback; |
| 257 } |
| 258 |
210 virtual void OnDownloadStored( | 259 virtual void OnDownloadStored( |
211 content::DownloadItem* item, | 260 content::DownloadItem* item, |
212 const history::DownloadRow& info) OVERRIDE { | 261 const history::DownloadRow& info) OVERRIDE { |
| 262 if (!callback_.is_null() && (!callback_.Run(info))) |
| 263 return; |
| 264 |
213 seen_stored_ = true; | 265 seen_stored_ = true; |
214 if (waiting_) | 266 if (waiting_) |
215 MessageLoopForUI::current()->Quit(); | 267 MessageLoopForUI::current()->Quit(); |
216 } | 268 } |
217 | 269 |
218 virtual void OnDownloadHistoryDestroyed() OVERRIDE { | 270 virtual void OnDownloadHistoryDestroyed() OVERRIDE { |
219 DownloadServiceFactory::GetForProfile(profile_)-> | 271 DownloadServiceFactory::GetForProfile(profile_)-> |
220 GetDownloadHistory()->RemoveObserver(this); | 272 GetDownloadHistory()->RemoveObserver(this); |
221 } | 273 } |
222 | 274 |
223 void WaitForStored() { | 275 void WaitForStored() { |
224 if (seen_stored_) | 276 if (seen_stored_) |
225 return; | 277 return; |
226 waiting_ = true; | 278 waiting_ = true; |
227 content::RunMessageLoop(); | 279 content::RunMessageLoop(); |
228 waiting_ = false; | 280 waiting_ = false; |
229 } | 281 } |
230 | 282 |
231 private: | 283 private: |
232 Profile* profile_; | 284 Profile* profile_; |
233 bool waiting_; | 285 bool waiting_; |
234 bool seen_stored_; | 286 bool seen_stored_; |
| 287 FilterCallback callback_; |
235 | 288 |
236 DISALLOW_COPY_AND_ASSIGN(HistoryObserver); | 289 DISALLOW_COPY_AND_ASSIGN(HistoryObserver); |
237 }; | 290 }; |
238 | 291 |
239 class DownloadTest : public InProcessBrowserTest { | 292 class DownloadTest : public InProcessBrowserTest { |
240 public: | 293 public: |
241 // Choice of navigation or direct fetch. Used by |DownloadFileCheckErrors()|. | 294 // Choice of navigation or direct fetch. Used by |DownloadFileCheckErrors()|. |
242 enum DownloadMethod { | 295 enum DownloadMethod { |
243 DOWNLOAD_NAVIGATE, | 296 DOWNLOAD_NAVIGATE, |
244 DOWNLOAD_DIRECT | 297 DOWNLOAD_DIRECT |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 SIZE_TEST_TYPE_UNKNOWN, | 367 SIZE_TEST_TYPE_UNKNOWN, |
315 }; | 368 }; |
316 | 369 |
317 // Location of the file source (the place from which it is downloaded). | 370 // Location of the file source (the place from which it is downloaded). |
318 FilePath OriginFile(FilePath file) { | 371 FilePath OriginFile(FilePath file) { |
319 return test_dir_.Append(file); | 372 return test_dir_.Append(file); |
320 } | 373 } |
321 | 374 |
322 // Location of the file destination (place to which it is downloaded). | 375 // Location of the file destination (place to which it is downloaded). |
323 FilePath DestinationFile(Browser* browser, FilePath file) { | 376 FilePath DestinationFile(Browser* browser, FilePath file) { |
324 return GetDownloadDirectory(browser).Append(file); | 377 return GetDownloadDirectory(browser).Append(file.BaseName()); |
325 } | 378 } |
326 | 379 |
327 // Must be called after browser creation. Creates a temporary | 380 // Must be called after browser creation. Creates a temporary |
328 // directory for downloads that is auto-deleted on destruction. | 381 // directory for downloads that is auto-deleted on destruction. |
329 // Returning false indicates a failure of the function, and should be asserted | 382 // Returning false indicates a failure of the function, and should be asserted |
330 // in the caller. | 383 // in the caller. |
331 bool CreateAndSetDownloadsDirectory(Browser* browser) { | 384 bool CreateAndSetDownloadsDirectory(Browser* browser) { |
332 if (!browser) | 385 if (!browser) |
333 return false; | 386 return false; |
334 | 387 |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 #endif | 1449 #endif |
1397 | 1450 |
1398 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1451 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1399 // Download shelf should close. Download panel stays open on ChromeOS. | 1452 // Download shelf should close. Download panel stays open on ChromeOS. |
1400 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 1453 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
1401 | 1454 |
1402 CheckDownload(browser(), file, file); | 1455 CheckDownload(browser(), file, file); |
1403 } | 1456 } |
1404 | 1457 |
1405 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { | 1458 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { |
1406 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1459 GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl); |
| 1460 FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); |
| 1461 |
| 1462 // We use the server so that we can get a redirect and test url_chain |
| 1463 // persistence. |
| 1464 ASSERT_TRUE(test_server()->Start()); |
| 1465 GURL redirect_url = test_server()->GetURL( |
| 1466 "server-redirect?" + download_url.spec()); |
| 1467 |
| 1468 // Download the url and wait until the object has been stored. |
| 1469 base::Time start(base::Time::Now()); |
| 1470 HistoryObserver observer(browser()->profile()); |
| 1471 observer.SetFilterCallback(base::Bind(&HasDataAndName)); |
| 1472 ui_test_utils::NavigateToURL(browser(), redirect_url); |
| 1473 observer.WaitForStored(); |
| 1474 |
| 1475 // Get the details on what was stored into the history. |
| 1476 scoped_ptr<std::vector<history::DownloadRow> > downloads_in_database; |
| 1477 ASSERT_TRUE(DownloadsHistoryDataCollector( |
| 1478 browser()->profile()).WaitForDownloadInfo(&downloads_in_database)); |
| 1479 ASSERT_EQ(1u, downloads_in_database->size()); |
| 1480 |
| 1481 // Confirm history storage is what you expect for a partially completed |
| 1482 // slow download job. |
| 1483 history::DownloadRow& row(downloads_in_database->at(0)); |
| 1484 EXPECT_EQ(DestinationFile(browser(), file), row.target_path); |
| 1485 EXPECT_EQ(download_util::GetCrDownloadPath(DestinationFile(browser(), file)), |
| 1486 row.current_path); |
| 1487 ASSERT_EQ(2u, row.url_chain.size()); |
| 1488 EXPECT_EQ(redirect_url.spec(), row.url_chain[0].spec()); |
| 1489 EXPECT_EQ(download_url.spec(), row.url_chain[1].spec()); |
| 1490 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, row.danger_type); |
| 1491 EXPECT_LE(start, row.start_time); |
| 1492 EXPECT_EQ(URLRequestSlowDownloadJob::kFirstDownloadSize, row.received_bytes); |
| 1493 EXPECT_EQ(URLRequestSlowDownloadJob::kFirstDownloadSize |
| 1494 + URLRequestSlowDownloadJob::kSecondDownloadSize, row.total_bytes); |
| 1495 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, row.state); |
| 1496 EXPECT_FALSE(row.opened); |
| 1497 |
| 1498 // Finish the download. We're ok relying on the history to be flushed |
| 1499 // at this point as our queries will be behind the history updates |
| 1500 // invoked by completion. |
| 1501 scoped_ptr<content::DownloadTestObserver> download_observer( |
| 1502 CreateWaiter(browser(), 1)); |
| 1503 ui_test_utils::NavigateToURL(browser(), |
| 1504 GURL(URLRequestSlowDownloadJob::kErrorDownloadUrl)); |
| 1505 download_observer->WaitForFinished(); |
| 1506 EXPECT_EQ(1u, download_observer->NumDownloadsSeenInState( |
| 1507 DownloadItem::INTERRUPTED)); |
| 1508 base::Time end(base::Time::Now()); |
| 1509 |
| 1510 // Get what was stored in the history. |
| 1511 ASSERT_TRUE(DownloadsHistoryDataCollector( |
| 1512 browser()->profile()).WaitForDownloadInfo(&downloads_in_database)); |
| 1513 ASSERT_EQ(1u, downloads_in_database->size()); |
| 1514 |
| 1515 // Confirm history storage is what you expect for a completed |
| 1516 // slow download job. |
| 1517 history::DownloadRow& row1(downloads_in_database->at(0)); |
| 1518 EXPECT_EQ(DestinationFile(browser(), file), row1.target_path); |
| 1519 EXPECT_EQ(download_util::GetCrDownloadPath(DestinationFile(browser(), file)), |
| 1520 row1.current_path); |
| 1521 ASSERT_EQ(2u, row1.url_chain.size()); |
| 1522 EXPECT_EQ(redirect_url.spec(), row1.url_chain[0].spec()); |
| 1523 EXPECT_EQ(download_url.spec(), row1.url_chain[1].spec()); |
| 1524 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, row1.danger_type); |
| 1525 EXPECT_LE(start, row1.start_time); |
| 1526 EXPECT_GE(end, row1.end_time); |
| 1527 EXPECT_EQ(URLRequestSlowDownloadJob::kFirstDownloadSize, |
| 1528 row1.received_bytes); |
| 1529 EXPECT_EQ(URLRequestSlowDownloadJob::kFirstDownloadSize |
| 1530 + URLRequestSlowDownloadJob::kSecondDownloadSize, row1.total_bytes); |
| 1531 EXPECT_EQ(content::DownloadItem::INTERRUPTED, row1.state); |
| 1532 EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, |
| 1533 row1.interrupt_reason); |
| 1534 EXPECT_FALSE(row1.opened); |
| 1535 } |
| 1536 |
| 1537 // Make sure a dangerous file shows up properly in the history. |
| 1538 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryDangerCheck) { |
| 1539 FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.jar")); |
1407 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1540 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 1541 |
| 1542 // Download the url and wait until the object has been stored. |
| 1543 scoped_ptr<content::DownloadTestObserver> download_observer( |
| 1544 new content::DownloadTestObserverTerminal( |
| 1545 DownloadManagerForBrowser(browser()), 1, |
| 1546 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_IGNORE)); |
| 1547 base::Time start(base::Time::Now()); |
1408 HistoryObserver observer(browser()->profile()); | 1548 HistoryObserver observer(browser()->profile()); |
1409 DownloadAndWait(browser(), download_url); | 1549 observer.SetFilterCallback(base::Bind(&HasDataAndName)); |
| 1550 ui_test_utils::NavigateToURL(browser(), download_url); |
1410 observer.WaitForStored(); | 1551 observer.WaitForStored(); |
| 1552 |
| 1553 // Get the details on what was stored into the history. |
| 1554 scoped_ptr<std::vector<history::DownloadRow> > downloads_in_database; |
| 1555 ASSERT_TRUE(DownloadsHistoryDataCollector( |
| 1556 browser()->profile()).WaitForDownloadInfo(&downloads_in_database)); |
| 1557 ASSERT_EQ(1u, downloads_in_database->size()); |
| 1558 |
| 1559 // Confirm history storage is what you expect for an unvalidated |
| 1560 // dangerous file. |
| 1561 history::DownloadRow& row(downloads_in_database->at(0)); |
| 1562 EXPECT_EQ(DestinationFile(browser(), file), row.target_path); |
| 1563 EXPECT_NE(download_util::GetCrDownloadPath(DestinationFile(browser(), file)), |
| 1564 row.current_path); |
| 1565 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, row.danger_type); |
| 1566 EXPECT_LE(start, row.start_time); |
| 1567 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, row.state); |
| 1568 EXPECT_FALSE(row.opened); |
| 1569 |
| 1570 // Validate the download and wait for it to finish. |
| 1571 std::vector<DownloadItem*> downloads; |
| 1572 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); |
| 1573 ASSERT_EQ(1u, downloads.size()); |
| 1574 downloads[0]->DangerousDownloadValidated(); |
| 1575 download_observer->WaitForFinished(); |
| 1576 |
| 1577 // Get history details and confirm it's what you expect. |
| 1578 downloads_in_database->clear(); |
| 1579 ASSERT_TRUE(DownloadsHistoryDataCollector( |
| 1580 browser()->profile()).WaitForDownloadInfo(&downloads_in_database)); |
| 1581 ASSERT_EQ(1u, downloads_in_database->size()); |
| 1582 history::DownloadRow& row1(downloads_in_database->at(0)); |
| 1583 EXPECT_EQ(DestinationFile(browser(), file), row1.target_path); |
| 1584 EXPECT_EQ(DestinationFile(browser(), file), row1.current_path); |
| 1585 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED, row1.danger_type); |
| 1586 EXPECT_LE(start, row1.start_time); |
| 1587 EXPECT_EQ(content::DownloadItem::COMPLETE, row1.state); |
| 1588 EXPECT_FALSE(row1.opened); |
| 1589 EXPECT_EQ(439u, row1.received_bytes); |
| 1590 EXPECT_EQ(439u, row1.total_bytes); |
1411 } | 1591 } |
1412 | 1592 |
1413 // Test for crbug.com/14505. This tests that chrome:// urls are still functional | 1593 // Test for crbug.com/14505. This tests that chrome:// urls are still functional |
1414 // after download of a file while viewing another chrome://. | 1594 // after download of a file while viewing another chrome://. |
1415 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { | 1595 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { |
1416 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1596 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1417 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1597 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1418 GURL flags_url(chrome::kChromeUIFlagsURL); | 1598 GURL flags_url(chrome::kChromeUIFlagsURL); |
1419 GURL extensions_url(chrome::kChromeUIExtensionsFrameURL); | 1599 GURL extensions_url(chrome::kChromeUIExtensionsFrameURL); |
1420 | 1600 |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 2405 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
2226 scoped_ptr<DownloadUrlParameters> params( | 2406 scoped_ptr<DownloadUrlParameters> params( |
2227 DownloadUrlParameters::FromWebContents(web_contents, url)); | 2407 DownloadUrlParameters::FromWebContents(web_contents, url)); |
2228 params->set_callback(base::Bind(&SetHiddenDownloadCallback)); | 2408 params->set_callback(base::Bind(&SetHiddenDownloadCallback)); |
2229 download_manager->DownloadUrl(params.Pass()); | 2409 download_manager->DownloadUrl(params.Pass()); |
2230 observer->WaitForFinished(); | 2410 observer->WaitForFinished(); |
2231 | 2411 |
2232 // Verify that download shelf is not shown. | 2412 // Verify that download shelf is not shown. |
2233 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 2413 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
2234 } | 2414 } |
OLD | NEW |