| 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 "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" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 const std::string& panel_name, const gfx::Rect& bounds) { | 389 const std::string& panel_name, const gfx::Rect& bounds) { |
| 390 CreatePanelParams params(panel_name, bounds, SHOW_AS_ACTIVE); | 390 CreatePanelParams params(panel_name, bounds, SHOW_AS_ACTIVE); |
| 391 return CreatePanelWithParams(params); | 391 return CreatePanelWithParams(params); |
| 392 } | 392 } |
| 393 | 393 |
| 394 Panel* BasePanelBrowserTest::CreatePanel(const std::string& panel_name) { | 394 Panel* BasePanelBrowserTest::CreatePanel(const std::string& panel_name) { |
| 395 CreatePanelParams params(panel_name, gfx::Rect(), SHOW_AS_ACTIVE); | 395 CreatePanelParams params(panel_name, gfx::Rect(), SHOW_AS_ACTIVE); |
| 396 return CreatePanelWithParams(params); | 396 return CreatePanelWithParams(params); |
| 397 } | 397 } |
| 398 | 398 |
| 399 Panel* BasePanelBrowserTest::CreateDockedPanel(const std::string& name, |
| 400 const gfx::Rect& bounds) { |
| 401 Panel* panel = CreatePanelWithBounds(name, bounds); |
| 402 EXPECT_EQ(PanelStrip::DOCKED, panel->panel_strip()->type()); |
| 403 return panel; |
| 404 } |
| 405 |
| 406 Panel* BasePanelBrowserTest::CreateDetachedPanel(const std::string& name, |
| 407 const gfx::Rect& bounds) { |
| 408 Panel* panel = CreatePanelWithBounds(name, bounds); |
| 409 panel->manager()->MovePanelToStrip(panel, |
| 410 PanelStrip::DETACHED, |
| 411 PanelStrip::DEFAULT_POSITION); |
| 412 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); |
| 413 // The panel is first created as docked panel, which ignores the specified |
| 414 // origin in |bounds|. We need to reposition the panel after it becomes |
| 415 // detached. |
| 416 panel->SetPanelBounds(bounds); |
| 417 WaitForBoundsAnimationFinished(panel); |
| 418 return panel; |
| 419 } |
| 420 |
| 421 Panel* BasePanelBrowserTest::CreateOverflowPanel(const std::string& name, |
| 422 const gfx::Rect& bounds) { |
| 423 // The overflow panel is always shown as inactive even though we pass |
| 424 // SHOW_AS_ACTIVE. |
| 425 CreatePanelParams params(name, bounds, SHOW_AS_ACTIVE); |
| 426 params.expected_active_state = SHOW_AS_INACTIVE; |
| 427 Panel* panel = CreatePanelWithParams(params); |
| 428 WaitForLayoutModeChanged(panel, PanelStrip::IN_OVERFLOW); |
| 429 return panel; |
| 430 } |
| 431 |
| 399 void BasePanelBrowserTest::CreateTestTabContents(Browser* browser) { | 432 void BasePanelBrowserTest::CreateTestTabContents(Browser* browser) { |
| 400 TabContentsWrapper* tab_contents = | 433 TabContentsWrapper* tab_contents = |
| 401 new TabContentsWrapper(new TestTabContents(browser->profile(), NULL)); | 434 new TabContentsWrapper(new TestTabContents(browser->profile(), NULL)); |
| 402 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); | 435 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); |
| 403 } | 436 } |
| 404 | 437 |
| 405 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( | 438 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( |
| 406 const FilePath::StringType& path, | 439 const FilePath::StringType& path, |
| 407 Extension::Location location, | 440 Extension::Location location, |
| 408 const DictionaryValue& extra_value) { | 441 const DictionaryValue& extra_value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 484 } |
| 452 | 485 |
| 453 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 486 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
| 454 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 487 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
| 455 } | 488 } |
| 456 | 489 |
| 457 std::string BasePanelBrowserTest::MakePanelName(int index) { | 490 std::string BasePanelBrowserTest::MakePanelName(int index) { |
| 458 std::string panel_name("Panel"); | 491 std::string panel_name("Panel"); |
| 459 return panel_name + base::IntToString(index); | 492 return panel_name + base::IntToString(index); |
| 460 } | 493 } |
| OLD | NEW |