| 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/views/location_bar/star_view.h" | 5 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/browser_dialogs.h" | 7 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_view.h" | 8 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 9 #include "chrome/browser/ui/views/toolbar_view.h" | 9 #include "chrome/browser/ui/views/toolbar_view.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 typedef InProcessBrowserTest StarViewTest; | 14 typedef InProcessBrowserTest StarViewTest; |
| 15 | 15 |
| 16 // Verify that clicking the bookmark star a second time hides the bookmark | 16 // Verify that clicking the bookmark star a second time hides the bookmark |
| 17 // bubble. | 17 // bubble. |
| 18 IN_PROC_BROWSER_TEST_F(StarViewTest, HideOnSecondClick) { | 18 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS) |
| 19 #define MAYBE_HideOnSecondClick DISABLED_HideOnSecondClick |
| 20 #else |
| 21 #define MAYBE_HideOnSecondClick HideOnSecondClick |
| 22 #endif |
| 23 IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) { |
| 19 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 24 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 20 browser()->window()); | 25 browser()->window()); |
| 21 views::ImageView* star_view = | 26 views::ImageView* star_view = |
| 22 browser_view->GetToolbarView()->location_bar()->star_view(); | 27 browser_view->GetToolbarView()->location_bar()->star_view(); |
| 23 | 28 |
| 24 ui::MouseEvent pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 29 ui::MouseEvent pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 25 ui::EF_LEFT_MOUSE_BUTTON); | 30 ui::EF_LEFT_MOUSE_BUTTON); |
| 26 ui::MouseEvent released_event(ui::ET_MOUSE_RELEASED, gfx::Point(), | 31 ui::MouseEvent released_event(ui::ET_MOUSE_RELEASED, gfx::Point(), |
| 27 gfx::Point(), ui::EF_LEFT_MOUSE_BUTTON); | 32 gfx::Point(), ui::EF_LEFT_MOUSE_BUTTON); |
| 28 | 33 |
| 29 // Verify that clicking once shows the bookmark bubble. | 34 // Verify that clicking once shows the bookmark bubble. |
| 30 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); | 35 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); |
| 31 star_view->OnMousePressed(pressed_event); | 36 star_view->OnMousePressed(pressed_event); |
| 32 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); | 37 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); |
| 33 star_view->OnMouseReleased(released_event); | 38 star_view->OnMouseReleased(released_event); |
| 34 EXPECT_TRUE(chrome::IsBookmarkBubbleViewShowing()); | 39 EXPECT_TRUE(chrome::IsBookmarkBubbleViewShowing()); |
| 35 | 40 |
| 36 // Verify that clicking again doesn't reshow it. | 41 // Verify that clicking again doesn't reshow it. |
| 37 star_view->OnMousePressed(pressed_event); | 42 star_view->OnMousePressed(pressed_event); |
| 38 // Hide the bubble manually. In the browser this would normally happen during | 43 // Hide the bubble manually. In the browser this would normally happen during |
| 39 // the event processing. | 44 // the event processing. |
| 40 chrome::HideBookmarkBubbleView(); | 45 chrome::HideBookmarkBubbleView(); |
| 41 MessageLoop::current()->RunUntilIdle(); | 46 MessageLoop::current()->RunUntilIdle(); |
| 42 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); | 47 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); |
| 43 star_view->OnMouseReleased(released_event); | 48 star_view->OnMouseReleased(released_event); |
| 44 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); | 49 EXPECT_FALSE(chrome::IsBookmarkBubbleViewShowing()); |
| 45 } | 50 } |
| 46 | 51 |
| 47 } // namespace | 52 } // namespace |
| OLD | NEW |