| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/download/download_service.h" | 7 #include "chrome/browser/download/download_service.h" |
| 8 #include "chrome/browser/download/download_service_factory.h" | 8 #include "chrome/browser/download/download_service_factory.h" |
| 9 #include "chrome/browser/net/url_request_mock_util.h" | 9 #include "chrome/browser/net/url_request_mock_util.h" |
| 10 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/test/base/ui_test_utils.h" | 32 #include "chrome/test/base/ui_test_utils.h" |
| 33 #include "content/public/browser/download_manager.h" | 33 #include "content/public/browser/download_manager.h" |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/common/url_constants.h" | 36 #include "content/public/common/url_constants.h" |
| 37 #include "content/test/net/url_request_mock_http_job.h" | 37 #include "content/test/net/url_request_mock_http_job.h" |
| 38 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 #include "ui/gfx/screen.h" | 40 #include "ui/gfx/screen.h" |
| 41 | 41 |
| 42 using content::BrowserContext; |
| 42 using content::BrowserThread; | 43 using content::BrowserThread; |
| 43 using content::DownloadItem; | 44 using content::DownloadItem; |
| 44 using content::DownloadManager; | 45 using content::DownloadManager; |
| 45 using content::WebContents; | 46 using content::WebContents; |
| 46 using extensions::Extension; | 47 using extensions::Extension; |
| 47 | 48 |
| 48 class PanelBrowserTest : public BasePanelBrowserTest { | 49 class PanelBrowserTest : public BasePanelBrowserTest { |
| 49 public: | 50 public: |
| 50 PanelBrowserTest() : BasePanelBrowserTest() { | 51 PanelBrowserTest() : BasePanelBrowserTest() { |
| 51 } | 52 } |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 | 1601 |
| 1601 private: | 1602 private: |
| 1602 // Location of the downloads directory for download tests. | 1603 // Location of the downloads directory for download tests. |
| 1603 ScopedTempDir downloads_directory_; | 1604 ScopedTempDir downloads_directory_; |
| 1604 }; | 1605 }; |
| 1605 | 1606 |
| 1606 class DownloadObserver : public content::DownloadManager::Observer { | 1607 class DownloadObserver : public content::DownloadManager::Observer { |
| 1607 public: | 1608 public: |
| 1608 explicit DownloadObserver(Profile* profile) | 1609 explicit DownloadObserver(Profile* profile) |
| 1609 : download_manager_( | 1610 : download_manager_( |
| 1610 DownloadServiceFactory::GetForProfile(profile)->GetDownloadManager()), | 1611 BrowserContext::GetDownloadManager(profile)), |
| 1611 saw_download_(false), | 1612 saw_download_(false), |
| 1612 waiting_(false) { | 1613 waiting_(false) { |
| 1613 download_manager_->AddObserver(this); | 1614 download_manager_->AddObserver(this); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 ~DownloadObserver() { | 1617 ~DownloadObserver() { |
| 1617 download_manager_->RemoveObserver(this); | 1618 download_manager_->RemoveObserver(this); |
| 1618 } | 1619 } |
| 1619 | 1620 |
| 1620 void WaitForDownload() { | 1621 void WaitForDownload() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false); | 1738 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false); |
| 1738 EXPECT_EQ(1, tabbed_browser->tab_count()); | 1739 EXPECT_EQ(1, tabbed_browser->tab_count()); |
| 1739 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); | 1740 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); |
| 1740 tabbed_browser->CloseWindow(); | 1741 tabbed_browser->CloseWindow(); |
| 1741 | 1742 |
| 1742 EXPECT_EQ(1, panel_browser->tab_count()); | 1743 EXPECT_EQ(1, panel_browser->tab_count()); |
| 1743 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); | 1744 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); |
| 1744 | 1745 |
| 1745 panel_browser->CloseWindow(); | 1746 panel_browser->CloseWindow(); |
| 1746 } | 1747 } |
| OLD | NEW |