| 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/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/download/download_service.h" | 8 #include "chrome/browser/download/download_service.h" |
| 9 #include "chrome/browser/download/download_service_factory.h" | 9 #include "chrome/browser/download/download_service_factory.h" |
| 10 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 DownloadManager* download_manager_; | 1481 DownloadManager* download_manager_; |
| 1482 bool saw_download_; | 1482 bool saw_download_; |
| 1483 bool waiting_; | 1483 bool waiting_; |
| 1484 }; | 1484 }; |
| 1485 | 1485 |
| 1486 // Verify that the download shelf is opened in the existing tabbed browser | 1486 // Verify that the download shelf is opened in the existing tabbed browser |
| 1487 // when a download is started in a Panel. | 1487 // when a download is started in a Panel. |
| 1488 IN_PROC_BROWSER_TEST_F(PanelDownloadTest, Download) { | 1488 IN_PROC_BROWSER_TEST_F(PanelDownloadTest, Download) { |
| 1489 Profile* profile = browser()->profile(); | 1489 Profile* profile = browser()->profile(); |
| 1490 ASSERT_TRUE(CreateDownloadDirectory(profile)); | 1490 ASSERT_TRUE(CreateDownloadDirectory(profile)); |
| 1491 Browser* panel_browser = Browser::CreateForApp(Browser::TYPE_PANEL, | 1491 Browser* panel_browser = Browser::CreateWithParams( |
| 1492 "PanelTest", | 1492 Browser::CreateParams::CreateForApp( |
| 1493 gfx::Rect(), | 1493 Browser::TYPE_PANEL, "PanelTest", gfx::Rect(), profile)); |
| 1494 profile); | |
| 1495 EXPECT_EQ(2U, BrowserList::size()); | 1494 EXPECT_EQ(2U, BrowserList::size()); |
| 1496 ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 1495 ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 1497 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); | 1496 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); |
| 1498 | 1497 |
| 1499 scoped_ptr<DownloadObserver> observer(new DownloadObserver(profile)); | 1498 scoped_ptr<DownloadObserver> observer(new DownloadObserver(profile)); |
| 1500 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1499 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 1501 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1500 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 1502 ui_test_utils::NavigateToURLWithDisposition( | 1501 ui_test_utils::NavigateToURLWithDisposition( |
| 1503 panel_browser, | 1502 panel_browser, |
| 1504 download_url, | 1503 download_url, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1535 #define MAYBE_DownloadNoTabbedBrowser DISABLED_DownloadNoTabbedBrowser | 1534 #define MAYBE_DownloadNoTabbedBrowser DISABLED_DownloadNoTabbedBrowser |
| 1536 #else | 1535 #else |
| 1537 #define MAYBE_DownloadNoTabbedBrowser DownloadNoTabbedBrowser | 1536 #define MAYBE_DownloadNoTabbedBrowser DownloadNoTabbedBrowser |
| 1538 #endif | 1537 #endif |
| 1539 // Verify that a new tabbed browser is created to display a download | 1538 // Verify that a new tabbed browser is created to display a download |
| 1540 // shelf when a download is started in a Panel and there is no existing | 1539 // shelf when a download is started in a Panel and there is no existing |
| 1541 // tabbed browser. | 1540 // tabbed browser. |
| 1542 IN_PROC_BROWSER_TEST_F(PanelDownloadTest, MAYBE_DownloadNoTabbedBrowser) { | 1541 IN_PROC_BROWSER_TEST_F(PanelDownloadTest, MAYBE_DownloadNoTabbedBrowser) { |
| 1543 Profile* profile = browser()->profile(); | 1542 Profile* profile = browser()->profile(); |
| 1544 ASSERT_TRUE(CreateDownloadDirectory(profile)); | 1543 ASSERT_TRUE(CreateDownloadDirectory(profile)); |
| 1545 Browser* panel_browser = Browser::CreateForApp(Browser::TYPE_PANEL, | 1544 Browser* panel_browser = Browser::CreateWithParams( |
| 1546 "PanelTest", | 1545 Browser::CreateParams::CreateForApp( |
| 1547 gfx::Rect(), | 1546 Browser::TYPE_PANEL, "PanelTest", gfx::Rect(), profile)); |
| 1548 profile); | |
| 1549 EXPECT_EQ(2U, BrowserList::size()); | 1547 EXPECT_EQ(2U, BrowserList::size()); |
| 1550 ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 1548 ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 1551 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); | 1549 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); |
| 1552 | 1550 |
| 1553 ui_test_utils::WindowedNotificationObserver signal( | 1551 ui_test_utils::WindowedNotificationObserver signal( |
| 1554 chrome::NOTIFICATION_BROWSER_CLOSED, | 1552 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 1555 content::Source<Browser>(browser())); | 1553 content::Source<Browser>(browser())); |
| 1556 browser()->CloseWindow(); | 1554 browser()->CloseWindow(); |
| 1557 signal.Wait(); | 1555 signal.Wait(); |
| 1558 ASSERT_EQ(1U, BrowserList::size()); | 1556 ASSERT_EQ(1U, BrowserList::size()); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 // position when tall panel brings up its titlebar. | 1748 // position when tall panel brings up its titlebar. |
| 1751 CloseWindowAndWait(panel1->browser()); | 1749 CloseWindowAndWait(panel1->browser()); |
| 1752 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 1750 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
| 1753 GetBalloonBottomPosition(balloon)); | 1751 GetBalloonBottomPosition(balloon)); |
| 1754 | 1752 |
| 1755 // Closing the remaining tall panel should move the notification balloon back | 1753 // Closing the remaining tall panel should move the notification balloon back |
| 1756 // to its original position. | 1754 // to its original position. |
| 1757 CloseWindowAndWait(panel2->browser()); | 1755 CloseWindowAndWait(panel2->browser()); |
| 1758 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 1756 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
| 1759 } | 1757 } |
| OLD | NEW |