Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 12213075: Swap deprecated BrowserList:: iterators for BrowserIterator in non-Windows code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r181832 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/net/url_request_mock_util.h" 11 #include "chrome/browser/net/url_request_mock_util.h"
12 #include "chrome/browser/prefs/browser_prefs.h" 12 #include "chrome/browser/prefs/browser_prefs.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 14 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
15 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 15 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_commands.h" 17 #include "chrome/browser/ui/browser_commands.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_iterator.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 21 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
22 #include "chrome/browser/ui/panels/docked_panel_collection.h" 22 #include "chrome/browser/ui/panels/docked_panel_collection.h"
23 #include "chrome/browser/ui/panels/native_panel.h" 23 #include "chrome/browser/ui/panels/native_panel.h"
24 #include "chrome/browser/ui/panels/panel.h" 24 #include "chrome/browser/ui/panels/panel.h"
25 #include "chrome/browser/ui/panels/panel_manager.h" 25 #include "chrome/browser/ui/panels/panel_manager.h"
26 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" 26 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h"
27 #include "chrome/browser/web_applications/web_app.h" 27 #include "chrome/browser/web_applications/web_app.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); 1654 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile()));
1655 content::WindowedNotificationObserver signal( 1655 content::WindowedNotificationObserver signal(
1656 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 1656 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
1657 content::NotificationService::AllSources()); 1657 content::NotificationService::AllSources());
1658 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS)); 1658 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS));
1659 signal.Wait(); 1659 signal.Wait();
1660 1660
1661 // Check that the new browser window that opened is dev tools window. 1661 // Check that the new browser window that opened is dev tools window.
1662 ++num_browsers; 1662 ++num_browsers;
1663 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); 1663 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile()));
1664 for (BrowserList::const_iterator iter = BrowserList::begin(); 1664 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) {
1665 iter != BrowserList::end(); ++iter) {
1666 if (*iter == browser()) 1665 if (*iter == browser())
1667 continue; 1666 continue;
1668 ASSERT_TRUE((*iter)->is_devtools()); 1667 ASSERT_TRUE((*iter)->is_devtools());
1669 } 1668 }
1670 1669
1671 panel->Close(); 1670 panel->Close();
1672 } 1671 }
1673 1672
1674 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { 1673 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) {
1675 // Create a test panel with web contents loaded. 1674 // Create a test panel with web contents loaded.
1676 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); 1675 CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE);
1677 GURL url(ui_test_utils::GetTestUrl( 1676 GURL url(ui_test_utils::GetTestUrl(
1678 base::FilePath(kTestDir), 1677 base::FilePath(kTestDir),
1679 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); 1678 base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html"))));
1680 params.url = url; 1679 params.url = url;
1681 Panel* panel = CreatePanelWithParams(params); 1680 Panel* panel = CreatePanelWithParams(params);
1682 1681
1683 // Open devtools console. 1682 // Open devtools console.
1684 size_t num_browsers = 1; 1683 size_t num_browsers = 1;
1685 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); 1684 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile()));
1686 content::WindowedNotificationObserver signal( 1685 content::WindowedNotificationObserver signal(
1687 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 1686 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
1688 content::NotificationService::AllSources()); 1687 content::NotificationService::AllSources());
1689 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE)); 1688 EXPECT_TRUE(panel->ExecuteCommandIfEnabled(IDC_DEV_TOOLS_CONSOLE));
1690 signal.Wait(); 1689 signal.Wait();
1691 1690
1692 // Check that the new browser window that opened is dev tools window. 1691 // Check that the new browser window that opened is dev tools window.
1693 ++num_browsers; 1692 ++num_browsers;
1694 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile())); 1693 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser()->profile()));
1695 for (BrowserList::const_iterator iter = BrowserList::begin(); 1694 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) {
1696 iter != BrowserList::end(); ++iter) {
1697 if (*iter == browser()) 1695 if (*iter == browser())
1698 continue; 1696 continue;
1699 ASSERT_TRUE((*iter)->is_devtools()); 1697 ASSERT_TRUE((*iter)->is_devtools());
1700 } 1698 }
1701 1699
1702 panel->Close(); 1700 panel->Close();
1703 } 1701 }
1704 1702
1705 #if defined(OS_WIN) 1703 #if defined(OS_WIN)
1706 #define MAYBE_Accelerator Accelerator 1704 #define MAYBE_Accelerator Accelerator
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 #else 1756 #else
1759 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize 1757 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize
1760 #endif 1758 #endif
1761 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, 1759 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest,
1762 MAYBE_FocusChangeEventOnMinimize) { 1760 MAYBE_FocusChangeEventOnMinimize) {
1763 // This is needed so the subsequently created panels can be activated. 1761 // This is needed so the subsequently created panels can be activated.
1764 // On a Mac, it transforms background-only test process into foreground one. 1762 // On a Mac, it transforms background-only test process into foreground one.
1765 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 1763 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
1766 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; 1764 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_;
1767 } 1765 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698