Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: chrome/browser/ui/views/location_bar/star_view_browsertest.cc

Issue 2374253002: Fix bookmark bubble/star view highlighting for Harmony. (Closed)
Patch Set: fix tests, move bubble creation to toolbar Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
34 // Verify that clicking the bookmark star a second time hides the bookmark 34 // Verify that clicking the bookmark star a second time hides the bookmark
35 // bubble. 35 // bubble.
36 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS) 36 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS)
37 #define MAYBE_HideOnSecondClick DISABLED_HideOnSecondClick 37 #define MAYBE_HideOnSecondClick DISABLED_HideOnSecondClick
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 = 44 views::View* star_view = browser_view->toolbar()->location_bar()->star_view();
45 browser_view->GetToolbarView()->location_bar()->star_view();
46 45
47 ui::MouseEvent pressed_event( 46 ui::MouseEvent pressed_event(
48 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 47 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
49 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 48 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
50 ui::MouseEvent released_event( 49 ui::MouseEvent released_event(
51 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 50 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
52 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 51 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
53 52
54 // Verify that clicking once shows the bookmark bubble. 53 // Verify that clicking once shows the bookmark bubble.
55 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 54 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
56 star_view->OnMousePressed(pressed_event); 55 star_view->OnMousePressed(pressed_event);
57 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 56 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
58 star_view->OnMouseReleased(released_event); 57 star_view->OnMouseReleased(released_event);
59 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); 58 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble());
60 59
61 // Verify that clicking again doesn't reshow it. 60 // Verify that clicking again doesn't reshow it.
62 star_view->OnMousePressed(pressed_event); 61 star_view->OnMousePressed(pressed_event);
63 // Hide the bubble manually. In the browser this would normally happen during 62 // Hide the bubble manually. In the browser this would normally happen during
64 // the event processing. 63 // the event processing.
65 BookmarkBubbleView::Hide(); 64 BookmarkBubbleView::Hide();
66 base::RunLoop().RunUntilIdle(); 65 base::RunLoop().RunUntilIdle();
67 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 66 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
68 star_view->OnMouseReleased(released_event); 67 star_view->OnMouseReleased(released_event);
69 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 68 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
70 } 69 }
71 70
72 } // namespace 71 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698