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

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

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 26 matching lines...) Expand all
37 #define MAYBE_HideOnSecondClick HideOnSecondClick 37 #define MAYBE_HideOnSecondClick HideOnSecondClick
38 #endif 38 #endif
39 IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) { 39 IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) {
40 BrowserView* browser_view = reinterpret_cast<BrowserView*>( 40 BrowserView* browser_view = reinterpret_cast<BrowserView*>(
41 browser()->window()); 41 browser()->window());
42 views::View* star_view = 42 views::View* star_view =
43 browser_view->GetToolbarView()->location_bar()->star_view(); 43 browser_view->GetToolbarView()->location_bar()->star_view();
44 44
45 ui::MouseEvent pressed_event( 45 ui::MouseEvent pressed_event(
46 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 46 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
47 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 47 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
48 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
48 ui::MouseEvent released_event( 49 ui::MouseEvent released_event(
49 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 50 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
50 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 51 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
52 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
51 53
52 // Verify that clicking once shows the bookmark bubble. 54 // Verify that clicking once shows the bookmark bubble.
53 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 55 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
54 star_view->OnMousePressed(pressed_event); 56 star_view->OnMousePressed(pressed_event);
55 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 57 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
56 star_view->OnMouseReleased(released_event); 58 star_view->OnMouseReleased(released_event);
57 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); 59 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble());
58 60
59 // Verify that clicking again doesn't reshow it. 61 // Verify that clicking again doesn't reshow it.
60 star_view->OnMousePressed(pressed_event); 62 star_view->OnMousePressed(pressed_event);
61 // Hide the bubble manually. In the browser this would normally happen during 63 // Hide the bubble manually. In the browser this would normally happen during
62 // the event processing. 64 // the event processing.
63 BookmarkBubbleView::Hide(); 65 BookmarkBubbleView::Hide();
64 base::MessageLoop::current()->RunUntilIdle(); 66 base::MessageLoop::current()->RunUntilIdle();
65 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 67 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
66 star_view->OnMouseReleased(released_event); 68 star_view->OnMouseReleased(released_event);
67 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 69 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
68 } 70 }
69 71
70 } // namespace 72 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698