Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/search_engines/template_url.h" | |
| 6 #include "chrome/browser/search_engines/template_url_service.h" | |
| 7 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
| 8 #include "chrome/browser/ui/views/first_run_bubble.h" | |
| 9 #include "chrome/test/base/testing_profile.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 #include "views/test/views_test_base.h" | |
| 12 #include "views/view.h" | |
| 13 #include "views/widget/widget.h" | |
| 14 | |
| 15 class FirstRunBubbleTest : public views::ViewsTestBase { | |
| 16 public: | |
| 17 FirstRunBubbleTest(); | |
| 18 virtual ~FirstRunBubbleTest(); | |
| 19 | |
| 20 // Overrides from views::ViewsTestBase: | |
| 21 virtual void SetUp() OVERRIDE; | |
| 22 | |
| 23 protected: | |
| 24 TestingProfile* profile() { return &profile_; } | |
| 25 | |
| 26 private: | |
| 27 TestingProfile profile_; | |
| 28 TemplateURL* default_t_url_; | |
| 29 | |
| 30 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); | |
| 31 }; | |
| 32 | |
| 33 FirstRunBubbleTest::FirstRunBubbleTest() : default_t_url_(NULL) {} | |
| 34 FirstRunBubbleTest::~FirstRunBubbleTest() {} | |
| 35 | |
| 36 void FirstRunBubbleTest::SetUp() { | |
| 37 ViewsTestBase::SetUp(); | |
| 38 profile_.CreateTemplateURLService(); | |
| 39 TemplateURLService* turl_model = | |
| 40 TemplateURLServiceFactory::GetForProfile(&profile_); | |
| 41 turl_model->Load(); | |
| 42 // Reset the default TemplateURL. | |
| 43 default_t_url_ = new TemplateURL(); | |
|
msw
2011/11/11 02:30:21
Outdent these three lines by two spaces.
alicet1
2011/11/12 00:03:51
Done.
| |
| 44 turl_model->Add(default_t_url_); | |
| 45 turl_model->SetDefaultSearchProvider(default_t_url_); | |
| 46 } | |
| 47 | |
| 48 TEST_F(FirstRunBubbleTest, CreateAndClose) { | |
| 49 gfx::Rect anchor(10, 20, 0, 0); | |
| 50 FirstRunBubble* delegate = | |
| 51 FirstRunBubble::Show(profile(), | |
| 52 NULL, | |
| 53 anchor, | |
| 54 views::BubbleBorder::TOP_LEFT, | |
| 55 FirstRun::MINIMAL_BUBBLE); | |
| 56 EXPECT_TRUE(delegate != NULL); | |
| 57 delegate->GetWidget()->CloseNow(); | |
| 58 } | |
| OLD | NEW |