| 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/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/debugger/devtools_window.h" | 8 #include "chrome/browser/debugger/devtools_window.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
| 10 #include "chrome/browser/prefs/browser_prefs.h" | 11 #include "chrome/browser/prefs/browser_prefs.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 14 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 14 #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" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 21 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 21 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 22 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
| 22 #include "chrome/browser/ui/panels/native_panel.h" | 23 #include "chrome/browser/ui/panels/native_panel.h" |
| 23 #include "chrome/browser/ui/panels/panel.h" | 24 #include "chrome/browser/ui/panels/panel.h" |
| 24 #include "chrome/browser/ui/panels/panel_manager.h" | 25 #include "chrome/browser/ui/panels/panel_manager.h" |
| 25 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" | 26 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" |
| 26 #include "chrome/browser/web_applications/web_app.h" | 27 #include "chrome/browser/web_applications/web_app.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/extensions/extension_manifest_constants.h" | 30 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 29 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/test/base/interactive_test_utils.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "content/public/browser/native_web_keyboard_event.h" | 35 #include "content/public/browser/native_web_keyboard_event.h" |
| 33 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
| 36 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
| 37 #include "content/test/net/url_request_mock_http_job.h" | 40 #include "content/test/net/url_request_mock_http_job.h" |
| 38 #include "extensions/common/constants.h" | 41 #include "extensions/common/constants.h" |
| 39 #include "net/base/net_util.h" | 42 #include "net/base/net_util.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; | 1743 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; |
| 1741 content::NativeWebKeyboardEvent key_event(key_msg); | 1744 content::NativeWebKeyboardEvent key_event(key_msg); |
| 1742 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; | 1745 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; |
| 1743 #else | 1746 #else |
| 1744 content::NativeWebKeyboardEvent key_event; | 1747 content::NativeWebKeyboardEvent key_event; |
| 1745 #endif | 1748 #endif |
| 1746 panel->HandleKeyboardEvent(key_event); | 1749 panel->HandleKeyboardEvent(key_event); |
| 1747 signal.Wait(); | 1750 signal.Wait(); |
| 1748 EXPECT_EQ(0, panel_manager->num_panels()); | 1751 EXPECT_EQ(0, panel_manager->num_panels()); |
| 1749 } | 1752 } |
| 1753 |
| 1754 class PanelExtensionApiTest : public ExtensionApiTest { |
| 1755 protected: |
| 1756 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 1757 ExtensionApiTest::SetUpCommandLine(command_line); |
| 1758 command_line->AppendSwitch(switches::kEnablePanels); |
| 1759 } |
| 1760 }; |
| 1761 |
| 1762 #if defined(OS_LINUX) || defined(USE_AURA) |
| 1763 // Focus test fails if there is no window manager on Linux. |
| 1764 // Aura panels have different behavior that do not apply to this test. |
| 1765 #define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize |
| 1766 #else |
| 1767 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize |
| 1768 #endif |
| 1769 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, |
| 1770 MAYBE_FocusChangeEventOnMinimize) { |
| 1771 // This is needed so the subsequently created panels can be activated. |
| 1772 // On a Mac, it transforms background-only test process into foreground one. |
| 1773 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 1774 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; |
| 1775 } |
| OLD | NEW |