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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 Panel* panel, Panel::ExpansionState expansion_state) { | 284 Panel* panel, Panel::ExpansionState expansion_state) { |
285 content::WindowedNotificationObserver signal( | 285 content::WindowedNotificationObserver signal( |
286 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, | 286 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
287 content::Source<Panel>(panel)); | 287 content::Source<Panel>(panel)); |
288 if (panel->expansion_state() == expansion_state) | 288 if (panel->expansion_state() == expansion_state) |
289 return; | 289 return; |
290 signal.Wait(); | 290 signal.Wait(); |
291 EXPECT_EQ(expansion_state, panel->expansion_state()); | 291 EXPECT_EQ(expansion_state, panel->expansion_state()); |
292 } | 292 } |
293 | 293 |
| 294 BasePanelBrowserTest::CreatePanelParams::CreatePanelParams( |
| 295 const std::string& name, |
| 296 const gfx::Rect& bounds, |
| 297 ActiveState show_flag) |
| 298 : name(name), |
| 299 bounds(bounds), |
| 300 show_flag(show_flag), |
| 301 wait_for_fully_created(true), |
| 302 expected_active_state(show_flag) { |
| 303 } |
| 304 |
294 Panel* BasePanelBrowserTest::CreatePanelWithParams( | 305 Panel* BasePanelBrowserTest::CreatePanelWithParams( |
295 const CreatePanelParams& params) { | 306 const CreatePanelParams& params) { |
296 #if defined(OS_MACOSX) | 307 #if defined(OS_MACOSX) |
297 // Opening panels on a Mac causes NSWindowController of the Panel window | 308 // Opening panels on a Mac causes NSWindowController of the Panel window |
298 // to be autoreleased. We need a pool drained after it's done so the test | 309 // to be autoreleased. We need a pool drained after it's done so the test |
299 // can close correctly. The NSWindowController of the Panel window controls | 310 // can close correctly. The NSWindowController of the Panel window controls |
300 // lifetime of the Browser object so we want to release it as soon as | 311 // lifetime of the Browser object so we want to release it as soon as |
301 // possible. In real Chrome, this is done by message pump. | 312 // possible. In real Chrome, this is done by message pump. |
302 // On non-Mac platform, this is an empty class. | 313 // On non-Mac platform, this is an empty class. |
303 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 314 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 484 } |
474 | 485 |
475 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 486 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
476 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 487 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
477 } | 488 } |
478 | 489 |
479 std::string BasePanelBrowserTest::MakePanelName(int index) { | 490 std::string BasePanelBrowserTest::MakePanelName(int index) { |
480 std::string panel_name("Panel"); | 491 std::string panel_name("Panel"); |
481 return panel_name + base::IntToString(index); | 492 return panel_name + base::IntToString(index); |
482 } | 493 } |
OLD | NEW |