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/first_run_bubble.h" | 5 #include "chrome/browser/ui/views/first_run_bubble.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 7 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
8 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
9 #include "components/search_engines/template_url.h" | 10 #include "components/search_engines/template_url.h" |
10 #include "components/search_engines/template_url_service.h" | 11 #include "components/search_engines/template_url_service.h" |
11 #include "content/public/test/test_browser_thread.h" | 12 #include "content/public/test/test_browser_thread.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
15 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
16 #include "ui/events/event_sink.h" | 17 #include "ui/events/event_sink.h" |
17 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); | 76 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); |
76 }; | 77 }; |
77 | 78 |
78 FirstRunBubbleTest::FirstRunBubbleTest() | 79 FirstRunBubbleTest::FirstRunBubbleTest() |
79 : ui_thread_(content::BrowserThread::UI, base::MessageLoop::current()) {} | 80 : ui_thread_(content::BrowserThread::UI, base::MessageLoop::current()) {} |
80 | 81 |
81 FirstRunBubbleTest::~FirstRunBubbleTest() {} | 82 FirstRunBubbleTest::~FirstRunBubbleTest() {} |
82 | 83 |
83 void FirstRunBubbleTest::SetUp() { | 84 void FirstRunBubbleTest::SetUp() { |
84 ViewsTestBase::SetUp(); | 85 ViewsTestBase::SetUp(); |
| 86 // Set the ChromeLayoutProvider as the default layout provider. |
| 87 test_views_delegate()->set_layout_provider( |
| 88 ChromeLayoutProvider::CreateLayoutProvider()); |
85 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 89 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
86 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | 90 profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
87 TemplateURLService* turl_model = | 91 TemplateURLService* turl_model = |
88 TemplateURLServiceFactory::GetForProfile(profile()); | 92 TemplateURLServiceFactory::GetForProfile(profile()); |
89 turl_model->Load(); | 93 turl_model->Load(); |
90 } | 94 } |
91 | 95 |
92 void FirstRunBubbleTest::CreateAndCloseBubbleOnEventTest(ui::Event* event) { | 96 void FirstRunBubbleTest::CreateAndCloseBubbleOnEventTest(ui::Event* event) { |
93 // Create the anchor and parent widgets. | 97 // Create the anchor and parent widgets. |
94 views::Widget::InitParams params = | 98 views::Widget::InitParams params = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 CreateAndCloseBubbleOnEventTest(&mouse_down); | 151 CreateAndCloseBubbleOnEventTest(&mouse_down); |
148 } | 152 } |
149 | 153 |
150 TEST_F(FirstRunBubbleTest, CloseBubbleOnTouchDownEvent) { | 154 TEST_F(FirstRunBubbleTest, CloseBubbleOnTouchDownEvent) { |
151 ui::TouchEvent touch_down( | 155 ui::TouchEvent touch_down( |
152 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(), | 156 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(), |
153 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); | 157 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); |
154 CreateAndCloseBubbleOnEventTest(&touch_down); | 158 CreateAndCloseBubbleOnEventTest(&touch_down); |
155 } | 159 } |
156 | 160 |
OLD | NEW |