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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
44 #include "content/test/net/url_request_mock_http_job.h" | 44 #include "content/test/net/url_request_mock_http_job.h" |
45 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
47 #include "ui/gfx/screen.h" | 47 #include "ui/gfx/screen.h" |
48 | 48 |
49 using content::BrowserThread; | 49 using content::BrowserThread; |
50 using content::DownloadItem; | 50 using content::DownloadItem; |
51 using content::DownloadManager; | 51 using content::DownloadManager; |
52 using content::WebContents; | 52 using content::WebContents; |
| 53 using extensions::Extension; |
53 | 54 |
54 class PanelBrowserTest : public BasePanelBrowserTest { | 55 class PanelBrowserTest : public BasePanelBrowserTest { |
55 public: | 56 public: |
56 PanelBrowserTest() : BasePanelBrowserTest() { | 57 PanelBrowserTest() : BasePanelBrowserTest() { |
57 } | 58 } |
58 | 59 |
59 protected: | 60 protected: |
60 // Helper function for debugging. | 61 // Helper function for debugging. |
61 void PrintAllPanelBounds() { | 62 void PrintAllPanelBounds() { |
62 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels(); | 63 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels(); |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 Panel* panel_other = CreatePanel(extension_app_name_other); | 1326 Panel* panel_other = CreatePanel(extension_app_name_other); |
1326 | 1327 |
1327 ui_test_utils::WindowedNotificationObserver signal( | 1328 ui_test_utils::WindowedNotificationObserver signal( |
1328 chrome::NOTIFICATION_BROWSER_CLOSED, | 1329 chrome::NOTIFICATION_BROWSER_CLOSED, |
1329 content::Source<Browser>(panel->browser())); | 1330 content::Source<Browser>(panel->browser())); |
1330 ui_test_utils::WindowedNotificationObserver signal1( | 1331 ui_test_utils::WindowedNotificationObserver signal1( |
1331 chrome::NOTIFICATION_BROWSER_CLOSED, | 1332 chrome::NOTIFICATION_BROWSER_CLOSED, |
1332 content::Source<Browser>(panel1->browser())); | 1333 content::Source<Browser>(panel1->browser())); |
1333 | 1334 |
1334 // Send unload notification on the first extension. | 1335 // Send unload notification on the first extension. |
1335 UnloadedExtensionInfo details(extension, | 1336 extensions::UnloadedExtensionInfo details(extension, |
1336 extension_misc::UNLOAD_REASON_UNINSTALL); | 1337 extension_misc::UNLOAD_REASON_UNINSTALL); |
1337 content::NotificationService::current()->Notify( | 1338 content::NotificationService::current()->Notify( |
1338 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 1339 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
1339 content::Source<Profile>(browser()->profile()), | 1340 content::Source<Profile>(browser()->profile()), |
1340 content::Details<UnloadedExtensionInfo>(&details)); | 1341 content::Details<extensions::UnloadedExtensionInfo>(&details)); |
1341 | 1342 |
1342 // Wait for the panels opened by the first extension to close. | 1343 // Wait for the panels opened by the first extension to close. |
1343 signal.Wait(); | 1344 signal.Wait(); |
1344 signal1.Wait(); | 1345 signal1.Wait(); |
1345 | 1346 |
1346 // Verify that the panel that's left is the panel from the second extension. | 1347 // Verify that the panel that's left is the panel from the second extension. |
1347 EXPECT_EQ(panel_other, panel_manager->panels()[0]); | 1348 EXPECT_EQ(panel_other, panel_manager->panels()[0]); |
1348 panel_other->Close(); | 1349 panel_other->Close(); |
1349 } | 1350 } |
1350 | 1351 |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 // position when tall panel brings up its titlebar. | 1902 // position when tall panel brings up its titlebar. |
1902 CloseWindowAndWait(panel1->browser()); | 1903 CloseWindowAndWait(panel1->browser()); |
1903 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 1904 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
1904 GetBalloonBottomPosition(balloon)); | 1905 GetBalloonBottomPosition(balloon)); |
1905 | 1906 |
1906 // Closing the remaining tall panel should move the notification balloon back | 1907 // Closing the remaining tall panel should move the notification balloon back |
1907 // to its original position. | 1908 // to its original position. |
1908 CloseWindowAndWait(panel2->browser()); | 1909 CloseWindowAndWait(panel2->browser()); |
1909 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 1910 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
1910 } | 1911 } |
OLD | NEW |