| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_PANELS_OLD_BASE_PANEL_BROWSER_TEST_H_ | |
| 6 #define CHROME_BROWSER_UI_PANELS_OLD_BASE_PANEL_BROWSER_TEST_H_ | |
| 7 | |
| 8 #include "base/values.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "chrome/browser/ui/panels/display_settings_provider.h" | |
| 11 #include "chrome/browser/ui/panels/panel.h" | |
| 12 #include "chrome/browser/ui/panels/panel_strip.h" | |
| 13 #include "chrome/common/extensions/extension.h" | |
| 14 #include "chrome/test/base/in_process_browser_test.h" | |
| 15 #include "ui/gfx/rect.h" | |
| 16 | |
| 17 class NativePanelTesting; | |
| 18 | |
| 19 class OldBasePanelBrowserTest : public InProcessBrowserTest { | |
| 20 public: | |
| 21 class MockDisplaySettingsProvider : public DisplaySettingsProvider { | |
| 22 public: | |
| 23 MockDisplaySettingsProvider() { } | |
| 24 virtual ~MockDisplaySettingsProvider() { } | |
| 25 | |
| 26 virtual void SetPrimaryScreenArea(const gfx::Rect& primary_screen_area) = 0; | |
| 27 virtual void SetWorkArea(const gfx::Rect& work_area) = 0; | |
| 28 virtual void EnableAutoHidingDesktopBar(DesktopBarAlignment alignment, | |
| 29 bool enabled, | |
| 30 int thickness) = 0; | |
| 31 virtual void SetDesktopBarVisibility(DesktopBarAlignment alignment, | |
| 32 DesktopBarVisibility visibility) = 0; | |
| 33 virtual void SetDesktopBarThickness(DesktopBarAlignment alignment, | |
| 34 int thickness) = 0; | |
| 35 }; | |
| 36 | |
| 37 OldBasePanelBrowserTest(); | |
| 38 virtual ~OldBasePanelBrowserTest(); | |
| 39 | |
| 40 // Linux bots use icewm which activate windows in ways that break | |
| 41 // certain panel tests. Skip those tests when running on the bots. | |
| 42 // We do not disable the tests to make it easy for developers to run | |
| 43 // them locally. | |
| 44 bool SkipTestIfIceWM(); | |
| 45 | |
| 46 // Gnome running compiz refuses to activate a window that was initially | |
| 47 // created as inactive, causing certain panel tests to fail. These tests | |
| 48 // pass fine on the bots, but fail for developers as Gnome running compiz | |
| 49 // is the typical linux dev machine configuration. We do not disable the | |
| 50 // tests to ensure we still have coverage on the bots. | |
| 51 bool SkipTestIfCompizWM(); | |
| 52 | |
| 53 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 54 virtual void SetUpOnMainThread() OVERRIDE; | |
| 55 | |
| 56 protected: | |
| 57 enum ActiveState { SHOW_AS_ACTIVE, SHOW_AS_INACTIVE }; | |
| 58 | |
| 59 struct CreatePanelParams { | |
| 60 std::string name; | |
| 61 gfx::Rect bounds; | |
| 62 ActiveState show_flag; | |
| 63 GURL url; | |
| 64 bool wait_for_fully_created; | |
| 65 ActiveState expected_active_state; | |
| 66 | |
| 67 CreatePanelParams(const std::string& name, | |
| 68 const gfx::Rect& bounds, | |
| 69 ActiveState show_flag); | |
| 70 }; | |
| 71 | |
| 72 Panel* CreatePanelWithParams(const CreatePanelParams& params); | |
| 73 Panel* CreatePanelWithBounds(const std::string& panel_name, | |
| 74 const gfx::Rect& bounds); | |
| 75 Panel* CreatePanel(const std::string& panel_name); | |
| 76 | |
| 77 Panel* CreateDockedPanel(const std::string& name, const gfx::Rect& bounds); | |
| 78 Panel* CreateDetachedPanel(const std::string& name, const gfx::Rect& bounds); | |
| 79 | |
| 80 static NativePanelTesting* CreateNativePanelTesting(Panel* panel); | |
| 81 | |
| 82 void WaitForPanelActiveState(Panel* panel, ActiveState state); | |
| 83 void WaitForWindowSizeAvailable(Panel* panel); | |
| 84 void WaitForBoundsAnimationFinished(Panel* panel); | |
| 85 void WaitForExpansionStateChanged(Panel* panel, | |
| 86 Panel::ExpansionState expansion_state); | |
| 87 | |
| 88 void CreateTestTabContents(Browser* browser); | |
| 89 | |
| 90 scoped_refptr<extensions::Extension> CreateExtension( | |
| 91 const FilePath::StringType& path, | |
| 92 extensions::Extension::Location location, | |
| 93 const DictionaryValue& extra_value); | |
| 94 | |
| 95 void MoveMouseAndWaitForExpansionStateChange(Panel* panel, | |
| 96 const gfx::Point& position); | |
| 97 static void MoveMouse(const gfx::Point& position); | |
| 98 void CloseWindowAndWait(Panel* panel); | |
| 99 static std::string MakePanelName(int index); | |
| 100 | |
| 101 // |primary_screen_area| must contain |work_area|. If empty rect is passed | |
| 102 // to |work_area|, it will be set to same as |primary_screen_area|. | |
| 103 void SetTestingAreas(const gfx::Rect& primary_screen_area, | |
| 104 const gfx::Rect& work_area); | |
| 105 | |
| 106 MockDisplaySettingsProvider* mock_display_settings_provider() const { | |
| 107 return mock_display_settings_provider_; | |
| 108 } | |
| 109 | |
| 110 // Some tests might not want to use the mock version. | |
| 111 void disable_display_settings_mock() { | |
| 112 mock_display_settings_enabled_ = false; | |
| 113 } | |
| 114 | |
| 115 static const FilePath::CharType* kTestDir; | |
| 116 | |
| 117 private: | |
| 118 // Passed to and owned by PanelManager. | |
| 119 MockDisplaySettingsProvider* mock_display_settings_provider_; | |
| 120 | |
| 121 bool mock_display_settings_enabled_; | |
| 122 }; | |
| 123 | |
| 124 #endif // CHROME_BROWSER_UI_PANELS_OLD_BASE_PANEL_BROWSER_TEST_H_ | |
| OLD | NEW |