| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chrome/browser/search_engines/template_url_service_factory.h" | 6 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 7 #include "chrome/browser/ui/views/first_run_bubble.h" | 7 #include "chrome/browser/ui/views/first_run_bubble.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "components/search_engines/template_url.h" | 9 #include "components/search_engines/template_url.h" |
| 10 #include "components/search_engines/template_url_service.h" | 10 #include "components/search_engines/template_url_service.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 96 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 97 std::unique_ptr<views::Widget> anchor_widget(new views::Widget); | 97 std::unique_ptr<views::Widget> anchor_widget(new views::Widget); |
| 98 anchor_widget->Init(params); | 98 anchor_widget->Init(params); |
| 99 anchor_widget->SetBounds(gfx::Rect(10, 10, 500, 500)); | 99 anchor_widget->SetBounds(gfx::Rect(10, 10, 500, 500)); |
| 100 anchor_widget->Show(); | 100 anchor_widget->Show(); |
| 101 | 101 |
| 102 FirstRunBubble* delegate = | 102 FirstRunBubble* delegate = |
| 103 FirstRunBubble::ShowBubble(NULL, anchor_widget->GetContentsView()); | 103 FirstRunBubble::ShowBubble(NULL, anchor_widget->GetContentsView()); |
| 104 EXPECT_TRUE(delegate != NULL); | 104 EXPECT_TRUE(delegate != NULL); |
| 105 | 105 |
| 106 anchor_widget->GetFocusManager()->SetFocusedView( | 106 anchor_widget->GetContentsView()->RequestFocus(); |
| 107 anchor_widget->GetContentsView()); | |
| 108 | 107 |
| 109 std::unique_ptr<WidgetClosingObserver> widget_observer( | 108 std::unique_ptr<WidgetClosingObserver> widget_observer( |
| 110 new WidgetClosingObserver(delegate->GetWidget())); | 109 new WidgetClosingObserver(delegate->GetWidget())); |
| 111 | 110 |
| 112 ui::EventDispatchDetails details = | 111 ui::EventDispatchDetails details = |
| 113 anchor_widget->GetNativeWindow()->GetHost()->event_processor()-> | 112 anchor_widget->GetNativeWindow()->GetHost()->event_processor()-> |
| 114 OnEventFromSource(event); | 113 OnEventFromSource(event); |
| 115 EXPECT_FALSE(details.dispatcher_destroyed); | 114 EXPECT_FALSE(details.dispatcher_destroyed); |
| 116 | 115 |
| 117 EXPECT_TRUE(widget_observer->widget_destroyed()); | 116 EXPECT_TRUE(widget_observer->widget_destroyed()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 146 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 145 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 147 CreateAndCloseBubbleOnEventTest(&mouse_down); | 146 CreateAndCloseBubbleOnEventTest(&mouse_down); |
| 148 } | 147 } |
| 149 | 148 |
| 150 TEST_F(FirstRunBubbleTest, CloseBubbleOnTouchDownEvent) { | 149 TEST_F(FirstRunBubbleTest, CloseBubbleOnTouchDownEvent) { |
| 151 ui::TouchEvent touch_down( | 150 ui::TouchEvent touch_down( |
| 152 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, ui::EventTimeForNow()); | 151 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, ui::EventTimeForNow()); |
| 153 CreateAndCloseBubbleOnEventTest(&touch_down); | 152 CreateAndCloseBubbleOnEventTest(&touch_down); |
| 154 } | 153 } |
| 155 | 154 |
| OLD | NEW |