| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 // Create a test panel with web contents loaded. | 1616 // Create a test panel with web contents loaded. |
| 1617 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); | 1617 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); |
| 1618 GURL url(ui_test_utils::GetTestUrl( | 1618 GURL url(ui_test_utils::GetTestUrl( |
| 1619 base::FilePath(kTestDir), | 1619 base::FilePath(kTestDir), |
| 1620 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | 1620 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1621 params.url = url; | 1621 params.url = url; |
| 1622 Panel* panel = CreatePanelWithParams(params); | 1622 Panel* panel = CreatePanelWithParams(params); |
| 1623 | 1623 |
| 1624 // Open devtools. | 1624 // Open devtools. |
| 1625 size_t num_browsers = 1; | 1625 size_t num_browsers = 1; |
| 1626 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1626 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); |
| 1627 browser()->profile(), | |
| 1628 browser()->host_desktop_type())); | |
| 1629 content::WindowedNotificationObserver signal( | 1627 content::WindowedNotificationObserver signal( |
| 1630 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1628 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1631 content::NotificationService::AllSources()); | 1629 content::NotificationService::AllSources()); |
| 1632 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); | 1630 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); |
| 1633 signal.Wait(); | 1631 signal.Wait(); |
| 1634 | 1632 |
| 1635 // Check that the new browser window that opened is dev tools window. | 1633 // Check that the new browser window that opened is dev tools window. |
| 1636 ++num_browsers; | 1634 ++num_browsers; |
| 1637 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1635 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); |
| 1638 browser()->profile(), | |
| 1639 browser()->host_desktop_type())); | |
| 1640 for (auto* b : *BrowserList::GetInstance()) { | 1636 for (auto* b : *BrowserList::GetInstance()) { |
| 1641 if (b == browser()) | 1637 if (b == browser()) |
| 1642 continue; | 1638 continue; |
| 1643 ASSERT_TRUE(b->is_devtools()); | 1639 ASSERT_TRUE(b->is_devtools()); |
| 1644 } | 1640 } |
| 1645 | 1641 |
| 1646 panel->Close(); | 1642 panel->Close(); |
| 1647 } | 1643 } |
| 1648 | 1644 |
| 1649 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { | 1645 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { |
| 1650 // Create a test panel with web contents loaded. | 1646 // Create a test panel with web contents loaded. |
| 1651 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); | 1647 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); |
| 1652 GURL url(ui_test_utils::GetTestUrl( | 1648 GURL url(ui_test_utils::GetTestUrl( |
| 1653 base::FilePath(kTestDir), | 1649 base::FilePath(kTestDir), |
| 1654 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | 1650 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1655 params.url = url; | 1651 params.url = url; |
| 1656 Panel* panel = CreatePanelWithParams(params); | 1652 Panel* panel = CreatePanelWithParams(params); |
| 1657 | 1653 |
| 1658 // Open devtools console. | 1654 // Open devtools console. |
| 1659 size_t num_browsers = 1; | 1655 size_t num_browsers = 1; |
| 1660 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1656 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); |
| 1661 browser()->profile(), | |
| 1662 browser()->host_desktop_type())); | |
| 1663 content::WindowedNotificationObserver signal( | 1657 content::WindowedNotificationObserver signal( |
| 1664 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1658 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1665 content::NotificationService::AllSources()); | 1659 content::NotificationService::AllSources()); |
| 1666 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); | 1660 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); |
| 1667 signal.Wait(); | 1661 signal.Wait(); |
| 1668 | 1662 |
| 1669 // Check that the new browser window that opened is dev tools window. | 1663 // Check that the new browser window that opened is dev tools window. |
| 1670 ++num_browsers; | 1664 ++num_browsers; |
| 1671 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1665 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); |
| 1672 browser()->profile(), | |
| 1673 browser()->host_desktop_type())); | |
| 1674 for (auto* b : *BrowserList::GetInstance()) { | 1666 for (auto* b : *BrowserList::GetInstance()) { |
| 1675 if (b == browser()) | 1667 if (b == browser()) |
| 1676 continue; | 1668 continue; |
| 1677 ASSERT_TRUE(b->is_devtools()); | 1669 ASSERT_TRUE(b->is_devtools()); |
| 1678 } | 1670 } |
| 1679 | 1671 |
| 1680 panel->Close(); | 1672 panel->Close(); |
| 1681 } | 1673 } |
| 1682 | 1674 |
| 1683 #if defined(OS_WIN) | 1675 #if defined(OS_WIN) |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 expected_prefix, | 1850 expected_prefix, |
| 1859 base::CompareCase::INSENSITIVE_ASCII)); | 1851 base::CompareCase::INSENSITIVE_ASCII)); |
| 1860 | 1852 |
| 1861 PanelManager::GetInstance()->CloseAll(); | 1853 PanelManager::GetInstance()->CloseAll(); |
| 1862 EXPECT_EQ(1U, task_manager.tasks().size()); | 1854 EXPECT_EQ(1U, task_manager.tasks().size()); |
| 1863 } | 1855 } |
| 1864 | 1856 |
| 1865 } // namespace | 1857 } // namespace |
| 1866 | 1858 |
| 1867 #endif // defined(ENABLE_TASK_MANAGER) | 1859 #endif // defined(ENABLE_TASK_MANAGER) |
| OLD | NEW |