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" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 content::Source<Panel>(panel)); | 264 content::Source<Panel>(panel)); |
265 if (panel_testing->IsWindowSizeKnown()) | 265 if (panel_testing->IsWindowSizeKnown()) |
266 return; | 266 return; |
267 signal.Wait(); | 267 signal.Wait(); |
268 EXPECT_TRUE(panel_testing->IsWindowSizeKnown()); | 268 EXPECT_TRUE(panel_testing->IsWindowSizeKnown()); |
269 } | 269 } |
270 | 270 |
271 void BasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { | 271 void BasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { |
272 scoped_ptr<NativePanelTesting> panel_testing( | 272 scoped_ptr<NativePanelTesting> panel_testing( |
273 CreateNativePanelTesting(panel)); | 273 CreateNativePanelTesting(panel)); |
274 content::WindowedNotificationObserver signal( | 274 // Sometimes there are several animations in sequence due to content |
275 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 275 // auto resizing. Wait for all animations to finish. |
276 content::Source<Panel>(panel)); | 276 while (panel_testing->IsAnimatingBounds()) { |
277 if (!panel_testing->IsAnimatingBounds()) | 277 content::WindowedNotificationObserver signal( |
278 return; | 278 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
279 signal.Wait(); | 279 content::Source<Panel>(panel)); |
280 EXPECT_TRUE(!panel_testing->IsAnimatingBounds()); | 280 if (!panel_testing->IsAnimatingBounds()) |
281 } | 281 return; |
282 | 282 signal.Wait(); |
283 void BasePanelBrowserTest::WaitForExpansionStateChanged( | 283 } |
284 Panel* panel, Panel::ExpansionState expansion_state) { | |
285 content::WindowedNotificationObserver signal( | |
286 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, | |
287 content::Source<Panel>(panel)); | |
288 if (panel->expansion_state() == expansion_state) | |
289 return; | |
290 signal.Wait(); | |
291 EXPECT_EQ(expansion_state, panel->expansion_state()); | |
292 } | 284 } |
293 | 285 |
294 BasePanelBrowserTest::CreatePanelParams::CreatePanelParams( | 286 BasePanelBrowserTest::CreatePanelParams::CreatePanelParams( |
295 const std::string& name, | 287 const std::string& name, |
296 const gfx::Rect& bounds, | 288 const gfx::Rect& bounds, |
297 ActiveState show_flag) | 289 ActiveState show_flag) |
298 : name(name), | 290 : name(name), |
299 bounds(bounds), | 291 bounds(bounds), |
300 show_flag(show_flag), | 292 show_flag(show_flag), |
301 wait_for_fully_created(true), | 293 wait_for_fully_created(true), |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 476 } |
485 | 477 |
486 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 478 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
487 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 479 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
488 } | 480 } |
489 | 481 |
490 std::string BasePanelBrowserTest::MakePanelName(int index) { | 482 std::string BasePanelBrowserTest::MakePanelName(int index) { |
491 std::string panel_name("Panel"); | 483 std::string panel_name("Panel"); |
492 return panel_name + base::IntToString(index); | 484 return panel_name + base::IntToString(index); |
493 } | 485 } |
OLD | NEW |