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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 16 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
17 #include "chrome/browser/ui/panels/native_panel.h" | 17 #include "chrome/browser/ui/panels/native_panel.h" |
18 #include "chrome/browser/ui/panels/panel_collection.h" | 18 #include "chrome/browser/ui/panels/panel_collection.h" |
19 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 19 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 20 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
20 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" | 21 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" |
21 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 22 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/extensions/extension_manifest_constants.h" | 26 #include "chrome/common/extensions/extension_manifest_constants.h" |
26 #include "chrome/test/base/interactive_test_utils.h" | 27 #include "chrome/test/base/interactive_test_utils.h" |
27 #include "chrome/test/base/ui_test_utils.h" | 28 #include "chrome/test/base/ui_test_utils.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "content/public/common/url_constants.h" | 30 #include "content/public/common/url_constants.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 PanelCollection::DEFAULT_POSITION); | 384 PanelCollection::DEFAULT_POSITION); |
384 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); | 385 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); |
385 // The panel is first created as docked panel, which ignores the specified | 386 // The panel is first created as docked panel, which ignores the specified |
386 // origin in |bounds|. We need to reposition the panel after it becomes | 387 // origin in |bounds|. We need to reposition the panel after it becomes |
387 // detached. | 388 // detached. |
388 panel->SetPanelBounds(bounds); | 389 panel->SetPanelBounds(bounds); |
389 WaitForBoundsAnimationFinished(panel); | 390 WaitForBoundsAnimationFinished(panel); |
390 return panel; | 391 return panel; |
391 } | 392 } |
392 | 393 |
| 394 Panel* BasePanelBrowserTest::CreateStackedPanel(const std::string& name, |
| 395 const gfx::Rect& bounds, |
| 396 StackedPanelCollection* stack) { |
| 397 Panel* panel = CreateDetachedPanel(name, bounds); |
| 398 panel->manager()->MovePanelToCollection(panel, |
| 399 stack, |
| 400 PanelCollection::DEFAULT_POSITION); |
| 401 EXPECT_EQ(PanelCollection::STACKED, panel->collection()->type()); |
| 402 WaitForBoundsAnimationFinished(panel); |
| 403 return panel; |
| 404 } |
| 405 |
393 // static | 406 // static |
394 NativePanelTesting* BasePanelBrowserTest::CreateNativePanelTesting( | 407 NativePanelTesting* BasePanelBrowserTest::CreateNativePanelTesting( |
395 Panel* panel) { | 408 Panel* panel) { |
396 return panel->native_panel()->CreateNativePanelTesting(); | 409 return panel->native_panel()->CreateNativePanelTesting(); |
397 } | 410 } |
398 | 411 |
399 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( | 412 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( |
400 const FilePath::StringType& path, | 413 const FilePath::StringType& path, |
401 Extension::Location location, | 414 Extension::Location location, |
402 const DictionaryValue& extra_value) { | 415 const DictionaryValue& extra_value) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 480 } |
468 | 481 |
469 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 482 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
470 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 483 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
471 } | 484 } |
472 | 485 |
473 std::string BasePanelBrowserTest::MakePanelName(int index) { | 486 std::string BasePanelBrowserTest::MakePanelName(int index) { |
474 std::string panel_name("Panel"); | 487 std::string panel_name("Panel"); |
475 return panel_name + base::IntToString(index); | 488 return panel_name + base::IntToString(index); |
476 } | 489 } |
OLD | NEW |