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