OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 6 |
| 7 #include "chrome/browser/ui/browser_list.h" |
| 8 |
| 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop.h" |
| 13 #include "base/path_service.h" |
| 14 #include "base/string_number_conversions.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/panels/native_panel.h" |
| 19 #include "chrome/browser/ui/panels/panel_browser_window.h" |
| 20 #include "chrome/browser/ui/panels/panel_manager.h" |
| 21 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 23 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 27 #include "chrome/common/string_ordinal.h" |
| 28 #include "chrome/test/base/ui_test_utils.h" |
| 29 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/common/url_constants.h" |
| 31 #include "content/public/test/web_contents_tester.h" |
| 32 |
| 33 #if defined(OS_LINUX) |
| 34 #include "ui/base/x/x11_util.h" |
| 35 #endif |
| 36 |
| 37 #if defined(OS_MACOSX) |
| 38 #include "base/mac/scoped_nsautorelease_pool.h" |
| 39 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 40 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
| 41 #endif |
| 42 |
| 43 using content::WebContentsTester; |
| 44 using extensions::Extension; |
| 45 |
| 46 namespace { |
| 47 |
| 48 const gfx::Rect kTestingPrimaryScreenArea = gfx::Rect(0, 0, 800, 600); |
| 49 const gfx::Rect kTestingWorkArea = gfx::Rect(0, 0, 800, 580); |
| 50 |
| 51 struct MockDesktopBar { |
| 52 bool auto_hiding_enabled; |
| 53 DisplaySettingsProvider::DesktopBarVisibility visibility; |
| 54 int thickness; |
| 55 }; |
| 56 |
| 57 class MockDisplaySettingsProviderImpl : |
| 58 public BasePanelBrowserTest::MockDisplaySettingsProvider { |
| 59 public: |
| 60 explicit MockDisplaySettingsProviderImpl(PanelManager* panel_manager); |
| 61 virtual ~MockDisplaySettingsProviderImpl() { } |
| 62 |
| 63 // Overridden from DisplaySettingsProvider: |
| 64 virtual gfx::Rect GetPrimaryScreenArea() const OVERRIDE; |
| 65 virtual gfx::Rect GetWorkArea() const OVERRIDE; |
| 66 virtual bool IsAutoHidingDesktopBarEnabled( |
| 67 DesktopBarAlignment alignment) OVERRIDE; |
| 68 virtual int GetDesktopBarThickness( |
| 69 DesktopBarAlignment alignment) const OVERRIDE; |
| 70 virtual DesktopBarVisibility GetDesktopBarVisibility( |
| 71 DesktopBarAlignment alignment) const OVERRIDE; |
| 72 |
| 73 // Overridden from MockDisplaySettingsProvider: |
| 74 virtual void SetPrimaryScreenArea( |
| 75 const gfx::Rect& primary_screen_area) OVERRIDE; |
| 76 virtual void SetWorkArea(const gfx::Rect& work_area) OVERRIDE; |
| 77 virtual void EnableAutoHidingDesktopBar(DesktopBarAlignment alignment, |
| 78 bool enabled, |
| 79 int thickness) OVERRIDE; |
| 80 virtual void SetDesktopBarVisibility( |
| 81 DesktopBarAlignment alignment, DesktopBarVisibility visibility) OVERRIDE; |
| 82 virtual void SetDesktopBarThickness(DesktopBarAlignment alignment, |
| 83 int thickness) OVERRIDE; |
| 84 |
| 85 private: |
| 86 gfx::Rect testing_primary_screen_area_; |
| 87 gfx::Rect testing_work_area_; |
| 88 MockDesktopBar mock_desktop_bars[3]; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(MockDisplaySettingsProviderImpl); |
| 91 }; |
| 92 |
| 93 |
| 94 MockDisplaySettingsProviderImpl::MockDisplaySettingsProviderImpl( |
| 95 PanelManager* panel_manager) { |
| 96 DisplaySettingsProvider* old_provider = |
| 97 panel_manager->display_settings_provider(); |
| 98 |
| 99 ObserverListBase<DisplaySettingsProvider::DisplayAreaObserver>::Iterator |
| 100 display_area_observers_iter(old_provider->display_area_observers()); |
| 101 AddDisplayAreaObserver(display_area_observers_iter.GetNext()); |
| 102 DCHECK(!display_area_observers_iter.GetNext()); |
| 103 |
| 104 ObserverListBase<DisplaySettingsProvider::DesktopBarObserver>::Iterator |
| 105 desktop_bar_observer_iter(old_provider->desktop_bar_observers()); |
| 106 AddDesktopBarObserver(desktop_bar_observer_iter.GetNext()); |
| 107 DCHECK(!desktop_bar_observer_iter.GetNext()); |
| 108 |
| 109 ObserverListBase<DisplaySettingsProvider::FullScreenObserver>::Iterator |
| 110 full_screen_observer_iter(old_provider->full_screen_observers()); |
| 111 AddFullScreenObserver(full_screen_observer_iter.GetNext()); |
| 112 DCHECK(!full_screen_observer_iter.GetNext()); |
| 113 |
| 114 panel_manager->set_display_settings_provider(this); |
| 115 |
| 116 memset(mock_desktop_bars, 0, sizeof(mock_desktop_bars)); |
| 117 } |
| 118 |
| 119 gfx::Rect MockDisplaySettingsProviderImpl::GetPrimaryScreenArea() const { |
| 120 return testing_primary_screen_area_; |
| 121 } |
| 122 |
| 123 gfx::Rect MockDisplaySettingsProviderImpl::GetWorkArea() const { |
| 124 return testing_work_area_; |
| 125 } |
| 126 |
| 127 bool MockDisplaySettingsProviderImpl::IsAutoHidingDesktopBarEnabled( |
| 128 DesktopBarAlignment alignment) { |
| 129 return mock_desktop_bars[static_cast<int>(alignment)].auto_hiding_enabled; |
| 130 } |
| 131 |
| 132 int MockDisplaySettingsProviderImpl::GetDesktopBarThickness( |
| 133 DesktopBarAlignment alignment) const { |
| 134 return mock_desktop_bars[static_cast<int>(alignment)].thickness; |
| 135 } |
| 136 |
| 137 DisplaySettingsProvider::DesktopBarVisibility |
| 138 MockDisplaySettingsProviderImpl::GetDesktopBarVisibility( |
| 139 DesktopBarAlignment alignment) const { |
| 140 return mock_desktop_bars[static_cast<int>(alignment)].visibility; |
| 141 } |
| 142 |
| 143 void MockDisplaySettingsProviderImpl::EnableAutoHidingDesktopBar( |
| 144 DesktopBarAlignment alignment, bool enabled, int thickness) { |
| 145 MockDesktopBar* bar = &(mock_desktop_bars[static_cast<int>(alignment)]); |
| 146 bar->auto_hiding_enabled = enabled; |
| 147 bar->thickness = thickness; |
| 148 OnAutoHidingDesktopBarChanged(); |
| 149 } |
| 150 |
| 151 void MockDisplaySettingsProviderImpl::SetPrimaryScreenArea( |
| 152 const gfx::Rect& primary_screen_area) { |
| 153 testing_primary_screen_area_ = primary_screen_area; |
| 154 } |
| 155 |
| 156 void MockDisplaySettingsProviderImpl::SetWorkArea(const gfx::Rect& work_area) { |
| 157 testing_work_area_ = work_area; |
| 158 OnDisplaySettingsChanged(); |
| 159 } |
| 160 |
| 161 void MockDisplaySettingsProviderImpl::SetDesktopBarVisibility( |
| 162 DesktopBarAlignment alignment, DesktopBarVisibility visibility) { |
| 163 MockDesktopBar* bar = &(mock_desktop_bars[static_cast<int>(alignment)]); |
| 164 if (!bar->auto_hiding_enabled) |
| 165 return; |
| 166 if (visibility == bar->visibility) |
| 167 return; |
| 168 bar->visibility = visibility; |
| 169 OnAutoHidingDesktopBarChanged(); |
| 170 } |
| 171 |
| 172 void MockDisplaySettingsProviderImpl::SetDesktopBarThickness( |
| 173 DesktopBarAlignment alignment, int thickness) { |
| 174 MockDesktopBar* bar = &(mock_desktop_bars[static_cast<int>(alignment)]); |
| 175 if (!bar->auto_hiding_enabled) |
| 176 return; |
| 177 if (thickness == bar->thickness) |
| 178 return; |
| 179 bar->thickness = thickness; |
| 180 OnAutoHidingDesktopBarChanged(); |
| 181 } |
| 182 |
| 183 bool ExistsPanel(Panel* panel) { |
| 184 std::vector<Panel*> panels = PanelManager::GetInstance()->panels(); |
| 185 return std::find(panels.begin(), panels.end(), panel) != panels.end(); |
| 186 } |
| 187 |
| 188 } // namespace |
| 189 |
| 190 const FilePath::CharType* BasePanelBrowserTest::kTestDir = |
| 191 FILE_PATH_LITERAL("panels"); |
| 192 |
| 193 BasePanelBrowserTest::BasePanelBrowserTest() |
| 194 : InProcessBrowserTest(), |
| 195 mock_display_settings_enabled_(true) { |
| 196 #if defined(OS_MACOSX) |
| 197 FindBarBridge::disable_animations_during_testing_ = true; |
| 198 #endif |
| 199 } |
| 200 |
| 201 BasePanelBrowserTest::~BasePanelBrowserTest() { |
| 202 } |
| 203 |
| 204 bool BasePanelBrowserTest::SkipTestIfIceWM() { |
| 205 #if defined(OS_LINUX) |
| 206 return ui::GuessWindowManager() == ui::WM_ICE_WM; |
| 207 #else |
| 208 return false; |
| 209 #endif |
| 210 } |
| 211 |
| 212 bool BasePanelBrowserTest::SkipTestIfCompizWM() { |
| 213 #if defined(OS_LINUX) |
| 214 return ui::GuessWindowManager() == ui::WM_COMPIZ; |
| 215 #else |
| 216 return false; |
| 217 #endif |
| 218 } |
| 219 |
| 220 void BasePanelBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
| 221 EnableDOMAutomation(); |
| 222 command_line->AppendSwitch(switches::kEnablePanels); |
| 223 } |
| 224 |
| 225 void BasePanelBrowserTest::SetUpOnMainThread() { |
| 226 InProcessBrowserTest::SetUpOnMainThread(); |
| 227 |
| 228 // Setup the work area and desktop bar so that we have consistent testing |
| 229 // environment for all panel related tests. |
| 230 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 231 if (mock_display_settings_enabled_) { |
| 232 mock_display_settings_provider_ = |
| 233 new MockDisplaySettingsProviderImpl(panel_manager); |
| 234 SetTestingAreas(kTestingPrimaryScreenArea, kTestingWorkArea); |
| 235 } |
| 236 |
| 237 panel_manager->enable_auto_sizing(false); |
| 238 |
| 239 PanelManager::shorten_time_intervals_for_testing(); |
| 240 |
| 241 // This is needed so the subsequently created panels can be activated. |
| 242 // On a Mac, it transforms background-only test process into foreground one. |
| 243 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 244 } |
| 245 |
| 246 void BasePanelBrowserTest::WaitForPanelActiveState( |
| 247 Panel* panel, ActiveState expected_state) { |
| 248 DCHECK(expected_state == SHOW_AS_ACTIVE || |
| 249 expected_state == SHOW_AS_INACTIVE); |
| 250 ui_test_utils::WindowedNotificationObserver signal( |
| 251 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, |
| 252 content::Source<Panel>(panel)); |
| 253 if (panel->IsActive() == (expected_state == SHOW_AS_ACTIVE)) |
| 254 return; // Already in required state. |
| 255 signal.Wait(); |
| 256 // Verify that transition happened in the desired direction. |
| 257 EXPECT_TRUE(panel->IsActive() == (expected_state == SHOW_AS_ACTIVE)); |
| 258 } |
| 259 |
| 260 void BasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) { |
| 261 scoped_ptr<NativePanelTesting> panel_testing( |
| 262 NativePanelTesting::Create(panel->native_panel())); |
| 263 ui_test_utils::WindowedNotificationObserver signal( |
| 264 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, |
| 265 content::Source<Panel>(panel)); |
| 266 if (panel_testing->IsWindowSizeKnown()) |
| 267 return; |
| 268 signal.Wait(); |
| 269 EXPECT_TRUE(panel_testing->IsWindowSizeKnown()); |
| 270 } |
| 271 |
| 272 void BasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { |
| 273 scoped_ptr<NativePanelTesting> panel_testing( |
| 274 NativePanelTesting::Create(panel->native_panel())); |
| 275 ui_test_utils::WindowedNotificationObserver signal( |
| 276 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 277 content::Source<Panel>(panel)); |
| 278 if (!panel_testing->IsAnimatingBounds()) |
| 279 return; |
| 280 signal.Wait(); |
| 281 EXPECT_TRUE(!panel_testing->IsAnimatingBounds()); |
| 282 } |
| 283 |
| 284 void BasePanelBrowserTest::WaitForExpansionStateChanged( |
| 285 Panel* panel, Panel::ExpansionState expansion_state) { |
| 286 ui_test_utils::WindowedNotificationObserver signal( |
| 287 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
| 288 content::Source<Panel>(panel)); |
| 289 if (panel->expansion_state() == expansion_state) |
| 290 return; |
| 291 signal.Wait(); |
| 292 EXPECT_EQ(expansion_state, panel->expansion_state()); |
| 293 } |
| 294 |
| 295 Panel* BasePanelBrowserTest::CreatePanelWithParams( |
| 296 const CreatePanelParams& params) { |
| 297 #if defined(OS_MACOSX) |
| 298 // Opening panels on a Mac causes NSWindowController of the Panel window |
| 299 // to be autoreleased. We need a pool drained after it's done so the test |
| 300 // can close correctly. The NSWindowController of the Panel window controls |
| 301 // lifetime of the Browser object so we want to release it as soon as |
| 302 // possible. In real Chrome, this is done by message pump. |
| 303 // On non-Mac platform, this is an empty class. |
| 304 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 305 #endif |
| 306 |
| 307 Browser* panel_browser = Browser::CreateWithParams( |
| 308 Browser::CreateParams::CreateForApp( |
| 309 Browser::TYPE_PANEL, params.name, params.bounds, |
| 310 browser()->profile())); |
| 311 EXPECT_TRUE(panel_browser->is_type_panel()); |
| 312 |
| 313 if (!params.url.is_empty()) { |
| 314 ui_test_utils::WindowedNotificationObserver observer( |
| 315 content::NOTIFICATION_LOAD_STOP, |
| 316 content::NotificationService::AllSources()); |
| 317 panel_browser->AddSelectedTabWithURL(params.url, |
| 318 content::PAGE_TRANSITION_START_PAGE); |
| 319 observer.Wait(); |
| 320 } |
| 321 |
| 322 PanelBrowserWindow* panel_browser_window = |
| 323 static_cast<PanelBrowserWindow*>(panel_browser->window()); |
| 324 Panel* panel = panel_browser_window->panel(); |
| 325 |
| 326 if (!PanelManager::GetInstance()->auto_sizing_enabled() || |
| 327 params.bounds.width() || params.bounds.height()) { |
| 328 EXPECT_FALSE(panel->auto_resizable()); |
| 329 } else { |
| 330 EXPECT_TRUE(panel->auto_resizable()); |
| 331 } |
| 332 |
| 333 #if defined(OS_LINUX) |
| 334 // On bots, we might have a simple window manager which always activates new |
| 335 // windows, and can't always deactivate them. Keep track of the previously |
| 336 // active window so we can activate that window back to ensure the new window |
| 337 // is inactive. |
| 338 Browser* last_active_browser_to_restore = NULL; |
| 339 if (params.expected_active_state == SHOW_AS_INACTIVE && |
| 340 ui::GuessWindowManager() == ui::WM_ICE_WM) { |
| 341 last_active_browser_to_restore = BrowserList::GetLastActive(); |
| 342 EXPECT_TRUE(last_active_browser_to_restore); |
| 343 EXPECT_NE(last_active_browser_to_restore, panel_browser); |
| 344 } |
| 345 #endif |
| 346 |
| 347 if (params.show_flag == SHOW_AS_ACTIVE) { |
| 348 panel->Show(); |
| 349 } else { |
| 350 panel->ShowInactive(); |
| 351 } |
| 352 |
| 353 if (params.wait_for_fully_created) { |
| 354 MessageLoopForUI::current()->RunAllPending(); |
| 355 |
| 356 #if defined(OS_LINUX) |
| 357 // Restore focus where it was. It will deactivate the new panel. |
| 358 if (last_active_browser_to_restore) |
| 359 last_active_browser_to_restore->window()->Activate(); |
| 360 #endif |
| 361 // More waiting, because gaining or losing focus may require inter-process |
| 362 // asynchronous communication, and it is not enough to just run the local |
| 363 // message loop to make sure this activity has completed. |
| 364 WaitForPanelActiveState(panel, params.expected_active_state); |
| 365 |
| 366 // On Linux, window size is not available right away and we should wait |
| 367 // before moving forward with the test. |
| 368 WaitForWindowSizeAvailable(panel); |
| 369 |
| 370 // Wait for the bounds animations on creation to finish. |
| 371 WaitForBoundsAnimationFinished(panel); |
| 372 } |
| 373 |
| 374 return panel; |
| 375 } |
| 376 |
| 377 Panel* BasePanelBrowserTest::CreatePanelWithBounds( |
| 378 const std::string& panel_name, const gfx::Rect& bounds) { |
| 379 CreatePanelParams params(panel_name, bounds, SHOW_AS_ACTIVE); |
| 380 return CreatePanelWithParams(params); |
| 381 } |
| 382 |
| 383 Panel* BasePanelBrowserTest::CreatePanel(const std::string& panel_name) { |
| 384 CreatePanelParams params(panel_name, gfx::Rect(), SHOW_AS_ACTIVE); |
| 385 return CreatePanelWithParams(params); |
| 386 } |
| 387 |
| 388 Panel* BasePanelBrowserTest::CreateDockedPanel(const std::string& name, |
| 389 const gfx::Rect& bounds) { |
| 390 Panel* panel = CreatePanelWithBounds(name, bounds); |
| 391 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); |
| 392 return panel; |
| 393 } |
| 394 |
| 395 Panel* BasePanelBrowserTest::CreateDetachedPanel(const std::string& name, |
| 396 const gfx::Rect& bounds) { |
| 397 Panel* panel = CreatePanelWithBounds(name, bounds); |
| 398 panel->manager()->MovePanelToStrip(panel, |
| 399 PanelStrip::DETACHED, |
| 400 PanelStrip::DEFAULT_POSITION); |
| 401 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); |
| 402 // The panel is first created as docked panel, which ignores the specified |
| 403 // origin in |bounds|. We need to reposition the panel after it becomes |
| 404 // detached. |
| 405 panel->SetPanelBounds(bounds); |
| 406 WaitForBoundsAnimationFinished(panel); |
| 407 return panel; |
| 408 } |
| 409 |
| 410 void BasePanelBrowserTest::CreateTestTabContents(Browser* browser) { |
| 411 TabContentsWrapper* tab_contents = |
| 412 new TabContentsWrapper( |
| 413 WebContentsTester::CreateTestWebContents(browser->profile(), NULL)); |
| 414 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); |
| 415 } |
| 416 |
| 417 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( |
| 418 const FilePath::StringType& path, |
| 419 Extension::Location location, |
| 420 const DictionaryValue& extra_value) { |
| 421 #if defined(OS_WIN) |
| 422 FilePath full_path(FILE_PATH_LITERAL("c:\\")); |
| 423 #else |
| 424 FilePath full_path(FILE_PATH_LITERAL("/")); |
| 425 #endif |
| 426 full_path = full_path.Append(path); |
| 427 |
| 428 scoped_ptr<DictionaryValue> input_value(extra_value.DeepCopy()); |
| 429 input_value->SetString(extension_manifest_keys::kVersion, "1.0.0.0"); |
| 430 input_value->SetString(extension_manifest_keys::kName, "Sample Extension"); |
| 431 |
| 432 std::string error; |
| 433 scoped_refptr<Extension> extension = Extension::Create( |
| 434 full_path, location, *input_value, Extension::NO_FLAGS, &error); |
| 435 EXPECT_TRUE(extension.get()); |
| 436 EXPECT_STREQ("", error.c_str()); |
| 437 browser()->profile()->GetExtensionService()-> |
| 438 OnExtensionInstalled(extension.get(), false, StringOrdinal()); |
| 439 return extension; |
| 440 } |
| 441 |
| 442 void BasePanelBrowserTest::SetTestingAreas(const gfx::Rect& primary_screen_area, |
| 443 const gfx::Rect& work_area) { |
| 444 DCHECK(primary_screen_area.Contains(work_area)); |
| 445 mock_display_settings_provider_->SetPrimaryScreenArea(primary_screen_area); |
| 446 mock_display_settings_provider_->SetWorkArea( |
| 447 work_area.IsEmpty() ? primary_screen_area : work_area); |
| 448 } |
| 449 |
| 450 void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { |
| 451 // Closing a panel may involve several async tasks. Need to use |
| 452 // message pump and wait for the notification. |
| 453 PanelManager* manager = PanelManager::GetInstance(); |
| 454 int panel_count = manager->num_panels(); |
| 455 ui_test_utils::WindowedNotificationObserver signal( |
| 456 chrome::NOTIFICATION_PANEL_CLOSED, |
| 457 content::Source<Panel>(panel)); |
| 458 panel->Close(); |
| 459 signal.Wait(); |
| 460 // Now we have one less panel. |
| 461 EXPECT_EQ(panel_count - 1, manager->num_panels()); |
| 462 |
| 463 #if defined(OS_MACOSX) |
| 464 // Mac window controllers may be autoreleased, and in the non-test |
| 465 // environment, may actually depend on the autorelease pool being recycled |
| 466 // with the run loop in order to perform important work. Replicate this in |
| 467 // the test environment. |
| 468 AutoreleasePool()->Recycle(); |
| 469 |
| 470 // Make sure that everything has a chance to run. |
| 471 chrome::testing::NSRunLoopRunAllPending(); |
| 472 #endif // OS_MACOSX |
| 473 } |
| 474 |
| 475 void BasePanelBrowserTest::MoveMouseAndWaitForExpansionStateChange( |
| 476 Panel* panel, |
| 477 const gfx::Point& position) { |
| 478 ui_test_utils::WindowedNotificationObserver signal( |
| 479 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
| 480 content::Source<Panel>(panel)); |
| 481 MoveMouse(position); |
| 482 signal.Wait(); |
| 483 } |
| 484 |
| 485 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
| 486 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
| 487 } |
| 488 |
| 489 std::string BasePanelBrowserTest::MakePanelName(int index) { |
| 490 std::string panel_name("Panel"); |
| 491 return panel_name + base::IntToString(index); |
| 492 } |
OLD | NEW |