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/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 void FirstRunBubbleTest::SetUp() { | 36 void FirstRunBubbleTest::SetUp() { |
37 ViewsTestBase::SetUp(); | 37 ViewsTestBase::SetUp(); |
38 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 38 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
39 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); | 39 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); |
40 TemplateURLService* turl_model = | 40 TemplateURLService* turl_model = |
41 TemplateURLServiceFactory::GetForProfile(&profile_); | 41 TemplateURLServiceFactory::GetForProfile(&profile_); |
42 turl_model->Load(); | 42 turl_model->Load(); |
43 } | 43 } |
44 | 44 |
45 TEST_F(FirstRunBubbleTest, CreateAndClose) { | 45 TEST_F(FirstRunBubbleTest, CreateAndClose) { |
46 FirstRunBubble* delegate = FirstRunBubble::ShowBubble(NULL, NULL); | 46 // Create the anchor and parent widgets. |
| 47 views::Widget::InitParams params = |
| 48 CreateParams(views::Widget::InitParams::TYPE_WINDOW); |
| 49 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 50 scoped_ptr<views::Widget> anchor_widget(new views::Widget); |
| 51 anchor_widget->Init(params); |
| 52 anchor_widget->Show(); |
| 53 |
| 54 FirstRunBubble* delegate = |
| 55 FirstRunBubble::ShowBubble(NULL, anchor_widget->GetContentsView()); |
47 EXPECT_TRUE(delegate != NULL); | 56 EXPECT_TRUE(delegate != NULL); |
48 delegate->GetWidget()->CloseNow(); | 57 delegate->GetWidget()->CloseNow(); |
49 } | 58 } |
OLD | NEW |