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 <vector> | |
9 #include "base/task.h" | 10 #include "base/task.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/ui/panels/auto_hiding_desktop_bar.h" | 13 #include "chrome/browser/ui/panels/auto_hiding_desktop_bar.h" |
13 #include "chrome/browser/ui/panels/panel.h" | 14 #include "chrome/browser/ui/panels/panel.h" |
14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
17 | 18 |
19 // Encapsulates all the info we care about a panel when we do the testing. | |
jennb
2011/12/08 23:52:00
If this is all for overflow, then create a PanelOv
jianli
2011/12/09 22:39:07
Done.
| |
20 struct PanelData { | |
21 Panel* panel; | |
22 std::string name; | |
23 Panel::ExpansionState expansion_state; | |
24 bool visible; | |
25 bool active; | |
26 | |
27 PanelData(); | |
28 explicit PanelData(Panel* panel); | |
29 bool operator==(const PanelData& another) const; | |
30 bool operator!=(const PanelData& another) const; | |
31 }; | |
32 | |
33 // For gtest printing. | |
34 ::std::ostream& operator<<(::std::ostream& os, const PanelData& data); | |
35 | |
36 class PanelDataList : public std::vector<PanelData> { | |
37 public: | |
38 PanelData* get(Panel* panel); | |
39 void insertBefore(Panel* before_panel, const PanelData& panel_data); | |
40 PanelData remove(Panel* panel); | |
41 }; | |
42 | |
18 class BasePanelBrowserTest : public InProcessBrowserTest { | 43 class BasePanelBrowserTest : public InProcessBrowserTest { |
19 public: | 44 public: |
20 class MockAutoHidingDesktopBar : public AutoHidingDesktopBar { | 45 class MockAutoHidingDesktopBar : public AutoHidingDesktopBar { |
21 public: | 46 public: |
22 virtual ~MockAutoHidingDesktopBar() { } | 47 virtual ~MockAutoHidingDesktopBar() { } |
23 | 48 |
24 virtual void EnableAutoHiding(Alignment alignment, | 49 virtual void EnableAutoHiding(Alignment alignment, |
25 bool enabled, | 50 bool enabled, |
26 int thickness) = 0; | 51 int thickness) = 0; |
27 virtual void SetVisibility(Alignment alignment, Visibility visibility) = 0; | 52 virtual void SetVisibility(Alignment alignment, Visibility visibility) = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 void WaitForBoundsAnimationFinished(Panel* panel); | 89 void WaitForBoundsAnimationFinished(Panel* panel); |
65 void WaitForExpansionStateChanged(Panel* panel, | 90 void WaitForExpansionStateChanged(Panel* panel, |
66 Panel::ExpansionState expansion_state); | 91 Panel::ExpansionState expansion_state); |
67 | 92 |
68 void CreateTestTabContents(Browser* browser); | 93 void CreateTestTabContents(Browser* browser); |
69 | 94 |
70 scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path, | 95 scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path, |
71 Extension::Location location, | 96 Extension::Location location, |
72 const DictionaryValue& extra_value); | 97 const DictionaryValue& extra_value); |
73 | 98 |
99 static std::string GetPanelName(int index); | |
100 static PanelDataList GetAllPanelData(); | |
101 | |
74 gfx::Rect testing_work_area() const { return testing_work_area_; } | 102 gfx::Rect testing_work_area() const { return testing_work_area_; } |
75 void set_testing_work_area(const gfx::Rect& work_area) { | 103 void set_testing_work_area(const gfx::Rect& work_area) { |
76 testing_work_area_ = work_area; | 104 testing_work_area_ = work_area; |
77 } | 105 } |
78 | 106 |
79 MockAutoHidingDesktopBar* mock_auto_hiding_desktop_bar() const { | 107 MockAutoHidingDesktopBar* mock_auto_hiding_desktop_bar() const { |
80 return mock_auto_hiding_desktop_bar_.get(); | 108 return mock_auto_hiding_desktop_bar_.get(); |
81 } | 109 } |
82 | 110 |
83 static const FilePath::CharType* kTestDir; | 111 static const FilePath::CharType* kTestDir; |
84 private: | 112 private: |
85 gfx::Rect testing_work_area_; | 113 gfx::Rect testing_work_area_; |
86 scoped_refptr<MockAutoHidingDesktopBar> mock_auto_hiding_desktop_bar_; | 114 scoped_refptr<MockAutoHidingDesktopBar> mock_auto_hiding_desktop_bar_; |
87 }; | 115 }; |
88 | 116 |
89 #endif // CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ | 117 #endif // CHROME_BROWSER_UI_PANELS_BASE_PANEL_BROWSER_TEST_H_ |
OLD | NEW |