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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/devtools/devtools_window.h" | 13 #include "chrome/browser/devtools/devtools_window.h" |
14 #include "chrome/browser/extensions/extension_apitest.h" | 14 #include "chrome/browser/extensions/extension_apitest.h" |
15 #include "chrome/browser/net/url_request_mock_util.h" | 15 #include "chrome/browser/net/url_request_mock_util.h" |
16 #include "chrome/browser/prefs/browser_prefs.h" | 16 #include "chrome/browser/prefs/browser_prefs.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/task_management/task_management_browsertest_util.h" | 18 #include "chrome/browser/task_management/task_management_browsertest_util.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
21 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
22 #include "chrome/browser/ui/browser_iterator.h" | 22 #include "chrome/browser/ui/browser_list.h" |
23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 24 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
25 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 25 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
26 #include "chrome/browser/ui/panels/native_panel.h" | 26 #include "chrome/browser/ui/panels/native_panel.h" |
27 #include "chrome/browser/ui/panels/panel.h" | 27 #include "chrome/browser/ui/panels/panel.h" |
28 #include "chrome/browser/ui/panels/panel_manager.h" | 28 #include "chrome/browser/ui/panels/panel_manager.h" |
29 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" | 29 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" |
30 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1630 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
1631 content::NotificationService::AllSources()); | 1631 content::NotificationService::AllSources()); |
1632 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); | 1632 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); |
1633 signal.Wait(); | 1633 signal.Wait(); |
1634 | 1634 |
1635 // Check that the new browser window that opened is dev tools window. | 1635 // Check that the new browser window that opened is dev tools window. |
1636 ++num_browsers; | 1636 ++num_browsers; |
1637 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1637 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
1638 browser()->profile(), | 1638 browser()->profile(), |
1639 browser()->host_desktop_type())); | 1639 browser()->host_desktop_type())); |
1640 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { | 1640 for (auto* b : *BrowserList::GetInstance()) { |
1641 if (*iter == browser()) | 1641 if (b == browser()) |
1642 continue; | 1642 continue; |
1643 ASSERT_TRUE((*iter)->is_devtools()); | 1643 ASSERT_TRUE(b->is_devtools()); |
1644 } | 1644 } |
1645 | 1645 |
1646 panel->Close(); | 1646 panel->Close(); |
1647 } | 1647 } |
1648 | 1648 |
1649 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { | 1649 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { |
1650 // Create a test panel with web contents loaded. | 1650 // Create a test panel with web contents loaded. |
1651 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); | 1651 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); |
1652 GURL url(ui_test_utils::GetTestUrl( | 1652 GURL url(ui_test_utils::GetTestUrl( |
1653 base::FilePath(kTestDir), | 1653 base::FilePath(kTestDir), |
(...skipping 10 matching lines...) Expand all Loading... |
1664 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1664 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
1665 content::NotificationService::AllSources()); | 1665 content::NotificationService::AllSources()); |
1666 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); | 1666 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); |
1667 signal.Wait(); | 1667 signal.Wait(); |
1668 | 1668 |
1669 // Check that the new browser window that opened is dev tools window. | 1669 // Check that the new browser window that opened is dev tools window. |
1670 ++num_browsers; | 1670 ++num_browsers; |
1671 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( | 1671 EXPECT_EQ(num_browsers, chrome::GetBrowserCount( |
1672 browser()->profile(), | 1672 browser()->profile(), |
1673 browser()->host_desktop_type())); | 1673 browser()->host_desktop_type())); |
1674 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { | 1674 for (auto* b : *BrowserList::GetInstance()) { |
1675 if (*iter == browser()) | 1675 if (b == browser()) |
1676 continue; | 1676 continue; |
1677 ASSERT_TRUE((*iter)->is_devtools()); | 1677 ASSERT_TRUE(b->is_devtools()); |
1678 } | 1678 } |
1679 | 1679 |
1680 panel->Close(); | 1680 panel->Close(); |
1681 } | 1681 } |
1682 | 1682 |
1683 #if defined(OS_WIN) | 1683 #if defined(OS_WIN) |
1684 #define MAYBE_Accelerator Accelerator | 1684 #define MAYBE_Accelerator Accelerator |
1685 #else | 1685 #else |
1686 #define MAYBE_Accelerator DISABLED_Accelerator | 1686 #define MAYBE_Accelerator DISABLED_Accelerator |
1687 #endif | 1687 #endif |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 expected_prefix, | 1858 expected_prefix, |
1859 base::CompareCase::INSENSITIVE_ASCII)); | 1859 base::CompareCase::INSENSITIVE_ASCII)); |
1860 | 1860 |
1861 PanelManager::GetInstance()->CloseAll(); | 1861 PanelManager::GetInstance()->CloseAll(); |
1862 EXPECT_EQ(1U, task_manager.tasks().size()); | 1862 EXPECT_EQ(1U, task_manager.tasks().size()); |
1863 } | 1863 } |
1864 | 1864 |
1865 } // namespace | 1865 } // namespace |
1866 | 1866 |
1867 #endif // defined(ENABLE_TASK_MANAGER) | 1867 #endif // defined(ENABLE_TASK_MANAGER) |
OLD | NEW |