| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_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/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/panels/native_panel.h" | 14 #include "chrome/browser/ui/panels/native_panel.h" |
| 15 #include "chrome/browser/ui/panels/panel.h" | 15 #include "chrome/browser/ui/panels/panel.h" |
| 16 #include "chrome/browser/ui/panels/panel_constants.h" | 16 #include "chrome/browser/ui/panels/panel_constants.h" |
| 17 #include "chrome/browser/ui/panels/panel_manager.h" | 17 #include "chrome/browser/ui/panels/panel_manager.h" |
| 18 #include "chrome/browser/web_applications/web_app.h" | 18 #include "chrome/browser/web_applications/web_app.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 EXPECT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); | 225 EXPECT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); |
| 226 | 226 |
| 227 // Execute the extension's custom menu item and wait for the extension's | 227 // Execute the extension's custom menu item and wait for the extension's |
| 228 // script to tell us its onclick fired. | 228 // script to tell us its onclick fired. |
| 229 ExtensionTestMessageListener onclick_listener("clicked", false); | 229 ExtensionTestMessageListener onclick_listener("clicked", false); |
| 230 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; | 230 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; |
| 231 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); | 231 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); |
| 232 menu->ExecuteCommand(command_id); | 232 menu->ExecuteCommand(command_id); |
| 233 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); | 233 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); |
| 234 } | 234 } |
| 235 | |
| 236 class PanelExtensionApiTest : public ExtensionApiTest { | |
| 237 protected: | |
| 238 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 239 ExtensionApiTest::SetUpCommandLine(command_line); | |
| 240 command_line->AppendSwitch(switches::kEnablePanels); | |
| 241 } | |
| 242 }; | |
| 243 | |
| 244 #if defined(OS_LINUX) || defined(USE_AURA) | |
| 245 // Focus test fails if there is no window manager on Linux. | |
| 246 // Aura panels have different behavior that do not apply to this test. | |
| 247 #define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize | |
| 248 #else | |
| 249 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize | |
| 250 #endif | |
| 251 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, | |
| 252 MAYBE_FocusChangeEventOnMinimize) { | |
| 253 // This is needed so the subsequently created panels can be activated. | |
| 254 // On a Mac, it transforms background-only test process into foreground one. | |
| 255 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | |
| 256 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; | |
| 257 } | |
| OLD | NEW |