| 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 "chrome/browser/ui/panels/base_panel_browser_test.h" | 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
| 17 #include "chrome/browser/ui/panels/native_panel.h" | 17 #include "chrome/browser/ui/panels/native_panel.h" |
| 18 #include "chrome/browser/ui/panels/panel_manager.h" | 18 #include "chrome/browser/ui/panels/panel_manager.h" |
| 19 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 19 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 20 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" | 20 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" |
| 21 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/extensions/extension_manifest_constants.h" | 26 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 26 #include "chrome/common/string_ordinal.h" | 27 #include "chrome/common/string_ordinal.h" |
| 27 #include "chrome/test/base/ui_test_utils.h" | 28 #include "chrome/test/base/ui_test_utils.h" |
| 28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/common/url_constants.h" | 30 #include "content/public/common/url_constants.h" |
| 30 #include "content/public/test/web_contents_tester.h" | 31 #include "content/public/test/web_contents_tester.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (mock_display_settings_enabled_) { | 231 if (mock_display_settings_enabled_) { |
| 231 mock_display_settings_provider_ = | 232 mock_display_settings_provider_ = |
| 232 new MockDisplaySettingsProviderImpl(panel_manager); | 233 new MockDisplaySettingsProviderImpl(panel_manager); |
| 233 SetTestingAreas(kTestingPrimaryScreenArea, kTestingWorkArea); | 234 SetTestingAreas(kTestingPrimaryScreenArea, kTestingWorkArea); |
| 234 } | 235 } |
| 235 | 236 |
| 236 panel_manager->enable_auto_sizing(false); | 237 panel_manager->enable_auto_sizing(false); |
| 237 | 238 |
| 238 PanelManager::shorten_time_intervals_for_testing(); | 239 PanelManager::shorten_time_intervals_for_testing(); |
| 239 | 240 |
| 241 // Simulate the mouse movement so that tests are not affected by actual mouse |
| 242 // events. |
| 243 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); |
| 244 panel_manager->SetMouseWatcherForTesting(mouse_watcher); |
| 245 |
| 240 // This is needed so the subsequently created panels can be activated. | 246 // This is needed so the subsequently created panels can be activated. |
| 241 // On a Mac, it transforms background-only test process into foreground one. | 247 // On a Mac, it transforms background-only test process into foreground one. |
| 242 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 248 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 243 } | 249 } |
| 244 | 250 |
| 245 void BasePanelBrowserTest::WaitForPanelActiveState( | 251 void BasePanelBrowserTest::WaitForPanelActiveState( |
| 246 Panel* panel, ActiveState expected_state) { | 252 Panel* panel, ActiveState expected_state) { |
| 247 DCHECK(expected_state == SHOW_AS_ACTIVE || | 253 DCHECK(expected_state == SHOW_AS_ACTIVE || |
| 248 expected_state == SHOW_AS_INACTIVE); | 254 expected_state == SHOW_AS_INACTIVE); |
| 249 PanelActiveStateObserver signal(panel, expected_state == SHOW_AS_ACTIVE); | 255 PanelActiveStateObserver signal(panel, expected_state == SHOW_AS_ACTIVE); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 473 } |
| 468 | 474 |
| 469 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 475 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
| 470 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 476 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
| 471 } | 477 } |
| 472 | 478 |
| 473 std::string BasePanelBrowserTest::MakePanelName(int index) { | 479 std::string BasePanelBrowserTest::MakePanelName(int index) { |
| 474 std::string panel_name("Panel"); | 480 std::string panel_name("Panel"); |
| 475 return panel_name + base::IntToString(index); | 481 return panel_name + base::IntToString(index); |
| 476 } | 482 } |
| OLD | NEW |