| 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/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 // Create a test panel with web contents loaded. | 1694 // Create a test panel with web contents loaded. |
| 1695 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); | 1695 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); |
| 1696 GURL url(ui_test_utils::GetTestUrl( | 1696 GURL url(ui_test_utils::GetTestUrl( |
| 1697 base::FilePath(kTestDir), | 1697 base::FilePath(kTestDir), |
| 1698 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | 1698 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1699 params.url = url; | 1699 params.url = url; |
| 1700 Panel* panel = CreatePanelWithParams(params); | 1700 Panel* panel = CreatePanelWithParams(params); |
| 1701 | 1701 |
| 1702 // Open devtools. | 1702 // Open devtools. |
| 1703 size_t num_browsers = 1; | 1703 size_t num_browsers = 1; |
| 1704 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); | 1704 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
| 1705 browser()->profile(), |
| 1706 browser()->host_desktop_type())); |
| 1705 content::WindowedNotificationObserver signal( | 1707 content::WindowedNotificationObserver signal( |
| 1706 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1708 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1707 content::NotificationService::AllSources()); | 1709 content::NotificationService::AllSources()); |
| 1708 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); | 1710 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); |
| 1709 signal.Wait(); | 1711 signal.Wait(); |
| 1710 | 1712 |
| 1711 // Check that the new browser window that opened is dev tools window. | 1713 // Check that the new browser window that opened is dev tools window. |
| 1712 ++num_browsers; | 1714 ++num_browsers; |
| 1713 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); | 1715 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
| 1716 browser()->profile(), |
| 1717 browser()->host_desktop_type())); |
| 1714 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { | 1718 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { |
| 1715 if (*iter == browser()) | 1719 if (*iter == browser()) |
| 1716 continue; | 1720 continue; |
| 1717 ASSERT_TRUE((*iter)->is_devtools()); | 1721 ASSERT_TRUE((*iter)->is_devtools()); |
| 1718 } | 1722 } |
| 1719 | 1723 |
| 1720 panel->Close(); | 1724 panel->Close(); |
| 1721 } | 1725 } |
| 1722 | 1726 |
| 1723 // http://crbug.com/175760; several panel tests failing regularly on mac. | 1727 // http://crbug.com/175760; several panel tests failing regularly on mac. |
| 1724 #if defined(OS_MACOSX) | 1728 #if defined(OS_MACOSX) |
| 1725 #define MAYBE_DevToolsConsole DISABLED_DevToolsConsole | 1729 #define MAYBE_DevToolsConsole DISABLED_DevToolsConsole |
| 1726 #else | 1730 #else |
| 1727 #define MAYBE_DevToolsConsole DevToolsConsole | 1731 #define MAYBE_DevToolsConsole DevToolsConsole |
| 1728 #endif | 1732 #endif |
| 1729 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { | 1733 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { |
| 1730 // Create a test panel with web contents loaded. | 1734 // Create a test panel with web contents loaded. |
| 1731 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); | 1735 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); |
| 1732 GURL url(ui_test_utils::GetTestUrl( | 1736 GURL url(ui_test_utils::GetTestUrl( |
| 1733 base::FilePath(kTestDir), | 1737 base::FilePath(kTestDir), |
| 1734 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | 1738 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1735 params.url = url; | 1739 params.url = url; |
| 1736 Panel* panel = CreatePanelWithParams(params); | 1740 Panel* panel = CreatePanelWithParams(params); |
| 1737 | 1741 |
| 1738 // Open devtools console. | 1742 // Open devtools console. |
| 1739 size_t num_browsers = 1; | 1743 size_t num_browsers = 1; |
| 1740 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); | 1744 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
| 1745 browser()->profile(), |
| 1746 browser()->host_desktop_type())); |
| 1741 content::WindowedNotificationObserver signal( | 1747 content::WindowedNotificationObserver signal( |
| 1742 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1748 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1743 content::NotificationService::AllSources()); | 1749 content::NotificationService::AllSources()); |
| 1744 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); | 1750 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); |
| 1745 signal.Wait(); | 1751 signal.Wait(); |
| 1746 | 1752 |
| 1747 // Check that the new browser window that opened is dev tools window. | 1753 // Check that the new browser window that opened is dev tools window. |
| 1748 ++num_browsers; | 1754 ++num_browsers; |
| 1749 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); | 1755 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
| 1756 browser()->profile(), |
| 1757 browser()->host_desktop_type())); |
| 1750 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { | 1758 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { |
| 1751 if (*iter == browser()) | 1759 if (*iter == browser()) |
| 1752 continue; | 1760 continue; |
| 1753 ASSERT_TRUE((*iter)->is_devtools()); | 1761 ASSERT_TRUE((*iter)->is_devtools()); |
| 1754 } | 1762 } |
| 1755 | 1763 |
| 1756 panel->Close(); | 1764 panel->Close(); |
| 1757 } | 1765 } |
| 1758 | 1766 |
| 1759 #if defined(OS_WIN) | 1767 #if defined(OS_WIN) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 #else | 1821 #else |
| 1814 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize | 1822 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize |
| 1815 #endif | 1823 #endif |
| 1816 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, | 1824 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, |
| 1817 MAYBE_FocusChangeEventOnMinimize) { | 1825 MAYBE_FocusChangeEventOnMinimize) { |
| 1818 // This is needed so the subsequently created panels can be activated. | 1826 // This is needed so the subsequently created panels can be activated. |
| 1819 // On a Mac, it transforms background-only test process into foreground one. | 1827 // On a Mac, it transforms background-only test process into foreground one. |
| 1820 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 1828 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 1821 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; | 1829 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; |
| 1822 } | 1830 } |
| OLD | NEW |