OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ |
6 #define CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ | 6 #define CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual void SetUpOnMainThread() OVERRIDE; | 35 virtual void SetUpOnMainThread() OVERRIDE; |
36 | 36 |
37 protected: | 37 protected: |
38 enum ActiveState { SHOW_AS_ACTIVE, SHOW_AS_INACTIVE }; | 38 enum ActiveState { SHOW_AS_ACTIVE, SHOW_AS_INACTIVE }; |
39 | 39 |
40 struct CreatePanelParams { | 40 struct CreatePanelParams { |
41 std::string name; | 41 std::string name; |
42 gfx::Rect bounds; | 42 gfx::Rect bounds; |
43 ActiveState show_flag; | 43 ActiveState show_flag; |
44 GURL url; | 44 GURL url; |
| 45 bool wait_for_fully_created; |
45 | 46 |
46 CreatePanelParams(const std::string& name, | 47 CreatePanelParams(const std::string& name, |
47 const gfx::Rect& bounds, | 48 const gfx::Rect& bounds, |
48 ActiveState show_flag) | 49 ActiveState show_flag) |
49 : name(name), | 50 : name(name), |
50 bounds(bounds), | 51 bounds(bounds), |
51 show_flag(show_flag) { | 52 show_flag(show_flag), |
| 53 wait_for_fully_created(true) { |
52 } | 54 } |
53 }; | 55 }; |
54 | 56 |
55 Panel* CreatePanelWithParams(const CreatePanelParams& params); | 57 Panel* CreatePanelWithParams(const CreatePanelParams& params); |
56 Panel* CreatePanelWithBounds(const std::string& panel_name, | 58 Panel* CreatePanelWithBounds(const std::string& panel_name, |
57 const gfx::Rect& bounds); | 59 const gfx::Rect& bounds); |
58 Panel* CreatePanel(const std::string& panel_name); | 60 Panel* CreatePanel(const std::string& panel_name); |
59 | 61 |
60 void WaitForPanelAdded(Panel* panel); | 62 void WaitForPanelAdded(Panel* panel); |
61 void WaitForPanelRemoved(Panel* panel); | 63 void WaitForPanelRemoved(Panel* panel); |
62 void WaitForPanelActiveState(Panel* panel, ActiveState state); | 64 void WaitForPanelActiveState(Panel* panel, ActiveState state); |
63 void WaitForWindowSizeAvailable(Panel* panel); | 65 void WaitForWindowSizeAvailable(Panel* panel); |
64 void WaitForBoundsAnimationFinished(Panel* panel); | 66 void WaitForBoundsAnimationFinished(Panel* panel); |
65 void WaitForExpansionStateChanged(Panel* panel, | 67 void WaitForExpansionStateChanged(Panel* panel, |
66 Panel::ExpansionState expansion_state); | 68 Panel::ExpansionState expansion_state); |
67 | 69 |
68 void CreateTestTabContents(Browser* browser); | 70 void CreateTestTabContents(Browser* browser); |
69 | 71 |
70 scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path, | 72 scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path, |
71 Extension::Location location, | 73 Extension::Location location, |
72 const DictionaryValue& extra_value); | 74 const DictionaryValue& extra_value); |
73 | 75 |
| 76 static void MoveMouse(const gfx::Point& position); |
| 77 static void CloseWindowAndWait(Browser* browser); |
| 78 static std::string MakePanelName(int index); |
| 79 |
74 gfx::Rect testing_work_area() const { return testing_work_area_; } | 80 gfx::Rect testing_work_area() const { return testing_work_area_; } |
75 void set_testing_work_area(const gfx::Rect& work_area) { | 81 void set_testing_work_area(const gfx::Rect& work_area) { |
76 testing_work_area_ = work_area; | 82 testing_work_area_ = work_area; |
77 } | 83 } |
78 | 84 |
79 MockAutoHidingDesktopBar* mock_auto_hiding_desktop_bar() const { | 85 MockAutoHidingDesktopBar* mock_auto_hiding_desktop_bar() const { |
80 return mock_auto_hiding_desktop_bar_.get(); | 86 return mock_auto_hiding_desktop_bar_.get(); |
81 } | 87 } |
82 | 88 |
83 static const FilePath::CharType* kTestDir; | 89 static const FilePath::CharType* kTestDir; |
84 private: | 90 private: |
85 gfx::Rect testing_work_area_; | 91 gfx::Rect testing_work_area_; |
86 scoped_refptr<MockAutoHidingDesktopBar> mock_auto_hiding_desktop_bar_; | 92 scoped_refptr<MockAutoHidingDesktopBar> mock_auto_hiding_desktop_bar_; |
87 }; | 93 }; |
88 | 94 |
89 #endif // CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ | 95 #endif // CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ |
OLD | NEW |