Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chrome/browser/ui/views/first_run_bubble_unittest.cc

Issue 1053663003: Cleanup: Remove unused variables in chrome/ found by Scythe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_service_factory.h" 5 #include "chrome/browser/search_engines/template_url_service_factory.h"
6 #include "chrome/browser/ui/views/first_run_bubble.h" 6 #include "chrome/browser/ui/views/first_run_bubble.h"
7 #include "chrome/test/base/testing_profile.h" 7 #include "chrome/test/base/testing_profile.h"
8 #include "components/search_engines/template_url.h" 8 #include "components/search_engines/template_url.h"
9 #include "components/search_engines/template_url_service.h" 9 #include "components/search_engines/template_url_service.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/views/test/views_test_base.h" 11 #include "ui/views/test/views_test_base.h"
12 #include "ui/views/view.h" 12 #include "ui/views/view.h"
13 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
14 14
15 class FirstRunBubbleTest : public views::ViewsTestBase { 15 class FirstRunBubbleTest : public views::ViewsTestBase {
16 public: 16 public:
17 FirstRunBubbleTest(); 17 FirstRunBubbleTest();
18 ~FirstRunBubbleTest() override; 18 ~FirstRunBubbleTest() override;
19 19
20 // Overrides from views::ViewsTestBase: 20 // Overrides from views::ViewsTestBase:
21 void SetUp() override; 21 void SetUp() override;
22 22
23 protected: 23 protected:
24 TestingProfile* profile() { return &profile_; } 24 TestingProfile* profile() { return &profile_; }
25 25
26 private: 26 private:
27 TestingProfile profile_; 27 TestingProfile profile_;
28 TemplateURL* default_t_url_;
29 28
30 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); 29 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest);
31 }; 30 };
32 31
33 FirstRunBubbleTest::FirstRunBubbleTest() : default_t_url_(NULL) {} 32 FirstRunBubbleTest::FirstRunBubbleTest() {}
34 FirstRunBubbleTest::~FirstRunBubbleTest() {} 33 FirstRunBubbleTest::~FirstRunBubbleTest() {}
35 34
36 void FirstRunBubbleTest::SetUp() { 35 void FirstRunBubbleTest::SetUp() {
37 ViewsTestBase::SetUp(); 36 ViewsTestBase::SetUp();
38 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 37 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
39 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); 38 &profile_, &TemplateURLServiceFactory::BuildInstanceFor);
40 TemplateURLService* turl_model = 39 TemplateURLService* turl_model =
41 TemplateURLServiceFactory::GetForProfile(&profile_); 40 TemplateURLServiceFactory::GetForProfile(&profile_);
42 turl_model->Load(); 41 turl_model->Load();
43 } 42 }
44 43
45 TEST_F(FirstRunBubbleTest, CreateAndClose) { 44 TEST_F(FirstRunBubbleTest, CreateAndClose) {
46 // Create the anchor and parent widgets. 45 // Create the anchor and parent widgets.
47 views::Widget::InitParams params = 46 views::Widget::InitParams params =
48 CreateParams(views::Widget::InitParams::TYPE_WINDOW); 47 CreateParams(views::Widget::InitParams::TYPE_WINDOW);
49 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 48 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
50 scoped_ptr<views::Widget> anchor_widget(new views::Widget); 49 scoped_ptr<views::Widget> anchor_widget(new views::Widget);
51 anchor_widget->Init(params); 50 anchor_widget->Init(params);
52 anchor_widget->Show(); 51 anchor_widget->Show();
53 52
54 FirstRunBubble* delegate = 53 FirstRunBubble* delegate =
55 FirstRunBubble::ShowBubble(NULL, anchor_widget->GetContentsView()); 54 FirstRunBubble::ShowBubble(NULL, anchor_widget->GetContentsView());
56 EXPECT_TRUE(delegate != NULL); 55 EXPECT_TRUE(delegate != NULL);
57 delegate->GetWidget()->CloseNow(); 56 delegate->GetWidget()->CloseNow();
58 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698