| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #else | 38 #else |
| 39 #define MAYBE_HideOnSecondClick HideOnSecondClick | 39 #define MAYBE_HideOnSecondClick HideOnSecondClick |
| 40 #endif | 40 #endif |
| 41 IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) { | 41 IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) { |
| 42 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 42 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 43 browser()->window()); | 43 browser()->window()); |
| 44 views::View* star_view = browser_view->toolbar()->location_bar()->star_view(); | 44 views::View* star_view = browser_view->toolbar()->location_bar()->star_view(); |
| 45 | 45 |
| 46 ui::MouseEvent pressed_event( | 46 ui::MouseEvent pressed_event( |
| 47 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 47 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 48 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 48 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 49 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 49 ui::MouseEvent released_event( | 50 ui::MouseEvent released_event( |
| 50 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 51 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 51 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 52 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 53 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 52 | 54 |
| 53 // Verify that clicking once shows the bookmark bubble. | 55 // Verify that clicking once shows the bookmark bubble. |
| 54 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 56 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 55 star_view->OnMousePressed(pressed_event); | 57 star_view->OnMousePressed(pressed_event); |
| 56 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 58 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 57 star_view->OnMouseReleased(released_event); | 59 star_view->OnMouseReleased(released_event); |
| 58 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 60 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
| 59 | 61 |
| 60 // Verify that clicking again doesn't reshow it. | 62 // Verify that clicking again doesn't reshow it. |
| 61 star_view->OnMousePressed(pressed_event); | 63 star_view->OnMousePressed(pressed_event); |
| 62 // Hide the bubble manually. In the browser this would normally happen during | 64 // Hide the bubble manually. In the browser this would normally happen during |
| 63 // the event processing. | 65 // the event processing. |
| 64 BookmarkBubbleView::Hide(); | 66 BookmarkBubbleView::Hide(); |
| 65 base::RunLoop().RunUntilIdle(); | 67 base::RunLoop().RunUntilIdle(); |
| 66 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 68 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 67 star_view->OnMouseReleased(released_event); | 69 star_view->OnMouseReleased(released_event); |
| 68 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 70 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 69 } | 71 } |
| 70 | 72 |
| 71 } // namespace | 73 } // namespace |
| OLD | NEW |