Index: chrome/browser/ui/views/frame/browser_view_unittest.cc |
diff --git a/chrome/browser/ui/views/frame/browser_view_unittest.cc b/chrome/browser/ui/views/frame/browser_view_unittest.cc |
index ccef538465c2870cd7fac73ec5f3cec88434d663..9a17dae3fcdd804e21a91c9f856ce0b27cd4fcc5 100644 |
--- a/chrome/browser/ui/views/frame/browser_view_unittest.cc |
+++ b/chrome/browser/ui/views/frame/browser_view_unittest.cc |
@@ -212,105 +212,3 @@ TEST_F(BrowserViewHostedAppTest, Layout) { |
EXPECT_EQ(browser_view()->frame()->GetTopInset() - 1, |
browser_view()->GetFindBarBoundingBox().y()); |
} |
- |
-#if defined(OS_WIN) |
- |
-// This class provides functionality to test the incognito window/normal window |
-// switcher button which is added to Windows 8 metro Chrome. |
-// We create the BrowserView ourselves in the |
-// BrowserWithTestWindowTest::CreateBrowserWindow function override and add the |
-// switcher button to the view. We also provide an incognito profile to ensure |
-// that the switcher button is visible. |
-class BrowserViewIncognitoSwitcherTest : public TestWithBrowserView { |
- public: |
- // Subclass of BrowserView, which overrides the GetRestoreBounds/IsMaximized |
- // functions to return dummy values. This is needed because we create the |
- // BrowserView instance ourselves and initialize it with the created Browser |
- // instance. These functions get called before the underlying Widget is |
- // initialized which causes a crash while dereferencing a null native_widget_ |
- // pointer in the Widget class. |
- class TestBrowserView : public BrowserView { |
- public: |
- virtual ~TestBrowserView() {} |
- |
- virtual gfx::Rect GetRestoredBounds() const OVERRIDE { |
- return gfx::Rect(); |
- } |
- virtual bool IsMaximized() const OVERRIDE { |
- return false; |
- } |
- }; |
- |
- BrowserViewIncognitoSwitcherTest() |
- : browser_view_(NULL) {} |
- |
- virtual void SetUp() OVERRIDE { |
- TestWithBrowserView::SetUp(); |
- browser_view_->Init(browser()); |
- (new BrowserFrame(browser_view_))->InitBrowserFrame(); |
- browser_view_->SetBounds(gfx::Rect(10, 10, 500, 500)); |
- browser_view_->Show(); |
- } |
- |
- virtual void TearDown() OVERRIDE { |
- // ok to release the window_ pointer because BrowserViewTest::TearDown |
- // deletes the BrowserView instance created. |
- release_browser_window(); |
- BrowserViewTest::TearDown(); |
- browser_view_ = NULL; |
- } |
- |
- virtual BrowserWindow* CreateBrowserWindow() OVERRIDE { |
- // We need an incognito profile for the window switcher button to be |
- // visible. |
- // This profile instance is owned by the TestingProfile instance within the |
- // BrowserWithTestWindowTest class. |
- TestingProfile::Builder builder; |
- builder.SetIncognito(); |
- GetProfile()->SetOffTheRecordProfile(builder.Build()); |
- |
- browser_view_ = new TestBrowserView(); |
- |
- views::ImageButton* switcher_button = new views::ImageButton(NULL); |
- // The button in the incognito window has the hot-cold images inverted |
- // with respect to the regular browser window. |
- switcher_button->SetImage( |
- views::ImageButton::STATE_NORMAL, |
- ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
- IDR_INCOGNITO_SWITCH_OFF)); |
- switcher_button->SetImage( |
- views::ImageButton::STATE_HOVERED, |
- ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
- IDR_INCOGNITO_SWITCH_ON)); |
- switcher_button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
- views::ImageButton::ALIGN_MIDDLE); |
- |
- browser_view_->SetWindowSwitcherButton(switcher_button); |
- return browser_view_; |
- } |
- |
- private: |
- BrowserView* browser_view_; |
- |
- DISALLOW_COPY_AND_ASSIGN(BrowserViewIncognitoSwitcherTest); |
-}; |
- |
-// Test whether the windows incognito/normal browser window switcher button |
-// is the event handler for a point within its bounds. The event handler for |
-// a point in the View class is dependent on the order in which children are |
-// added to it. This test ensures that we don't regress in the window switcher |
-// functionality when additional children are added to the BrowserView class. |
-TEST_F(BrowserViewIncognitoSwitcherTest, |
- BrowserViewIncognitoSwitcherEventHandlerTest) { |
- // |browser_view_| owns the Browser, not the test class. |
- EXPECT_TRUE(browser_view()->browser()); |
- // Test initial state. |
- EXPECT_TRUE(browser_view()->IsTabStripVisible()); |
- // Validate whether the window switcher button is the target for the position |
- // passed in. |
- gfx::Point switcher_point(browser_view()->window_switcher_button()->x() + 2, |
- browser_view()->window_switcher_button()->y()); |
- EXPECT_EQ(browser_view()->GetEventHandlerForPoint(switcher_point), |
- browser_view()->window_switcher_button()); |
-} |
-#endif |