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/search_engines/template_url.h" | 5 #include "chrome/browser/search_engines/template_url.h" |
6 #include "chrome/browser/search_engines/template_url_service.h" | 6 #include "chrome/browser/search_engines/template_url_service.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/first_run_bubble.h" | 8 #include "chrome/browser/ui/views/first_run_bubble.h" |
| 9 #include "chrome/browser/webdata/web_data_service_factory.h" |
9 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/views/test/views_test_base.h" | 12 #include "ui/views/test/views_test_base.h" |
12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
14 | 15 |
15 class FirstRunBubbleTest : public views::ViewsTestBase { | 16 class FirstRunBubbleTest : public views::ViewsTestBase { |
16 public: | 17 public: |
17 FirstRunBubbleTest(); | 18 FirstRunBubbleTest(); |
18 virtual ~FirstRunBubbleTest(); | 19 virtual ~FirstRunBubbleTest(); |
(...skipping 10 matching lines...) Expand all Loading... |
29 | 30 |
30 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); | 31 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); |
31 }; | 32 }; |
32 | 33 |
33 FirstRunBubbleTest::FirstRunBubbleTest() : default_t_url_(NULL) {} | 34 FirstRunBubbleTest::FirstRunBubbleTest() : default_t_url_(NULL) {} |
34 FirstRunBubbleTest::~FirstRunBubbleTest() {} | 35 FirstRunBubbleTest::~FirstRunBubbleTest() {} |
35 | 36 |
36 void FirstRunBubbleTest::SetUp() { | 37 void FirstRunBubbleTest::SetUp() { |
37 ViewsTestBase::SetUp(); | 38 ViewsTestBase::SetUp(); |
38 profile_.CreateTemplateURLService(); | 39 profile_.CreateTemplateURLService(); |
| 40 // WebDataService is not used in the test, but requires DB thread if |
| 41 // instantiated. |
| 42 WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile_, NULL); |
39 TemplateURLService* turl_model = | 43 TemplateURLService* turl_model = |
40 TemplateURLServiceFactory::GetForProfile(&profile_); | 44 TemplateURLServiceFactory::GetForProfile(&profile_); |
41 turl_model->Load(); | 45 turl_model->Load(); |
42 } | 46 } |
43 | 47 |
44 TEST_F(FirstRunBubbleTest, CreateAndClose) { | 48 TEST_F(FirstRunBubbleTest, CreateAndClose) { |
45 FirstRunBubble* delegate = FirstRunBubble::ShowBubble(profile(), NULL); | 49 FirstRunBubble* delegate = FirstRunBubble::ShowBubble(profile(), NULL); |
46 EXPECT_TRUE(delegate != NULL); | 50 EXPECT_TRUE(delegate != NULL); |
47 delegate->GetWidget()->CloseNow(); | 51 delegate->GetWidget()->CloseNow(); |
48 } | 52 } |
OLD | NEW |