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

Side by Side Diff: chrome/browser/ui/app_list/app_list_shower_views_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/app_list/app_list_shower_views.h" 5 #include "chrome/browser/ui/app_list/app_list_shower_views.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" 11 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h"
11 #include "chrome/browser/ui/app_list/test/fake_profile.h" 12 #include "chrome/browser/ui/app_list/test/fake_profile.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace { 15 namespace {
15 16
16 class FakeAppListShower : public AppListShower { 17 class FakeAppListShower : public AppListShower {
17 public: 18 public:
18 explicit FakeAppListShower(AppListShowerDelegate* delegate) 19 explicit FakeAppListShower(AppListShowerDelegate* delegate)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 views_dismissed_(0) {} 63 views_dismissed_(0) {}
63 64
64 void SetUp() override { 65 void SetUp() override {
65 shower_.reset(new FakeAppListShower(this)); 66 shower_.reset(new FakeAppListShower(this));
66 profile1_ = CreateProfile("p1"); 67 profile1_ = CreateProfile("p1");
67 profile2_ = CreateProfile("p2"); 68 profile2_ = CreateProfile("p2");
68 } 69 }
69 70
70 void TearDown() override {} 71 void TearDown() override {}
71 72
72 scoped_ptr<FakeProfile> CreateProfile(const std::string& name) { 73 std::unique_ptr<FakeProfile> CreateProfile(const std::string& name) {
73 return make_scoped_ptr(new FakeProfile(name)); 74 return base::WrapUnique(new FakeProfile(name));
74 } 75 }
75 76
76 // AppListShowerDelegate: 77 // AppListShowerDelegate:
77 AppListViewDelegate* GetViewDelegateForCreate() override { return NULL; } 78 AppListViewDelegate* GetViewDelegateForCreate() override { return NULL; }
78 79
79 bool HasKeepAlive() const { 80 bool HasKeepAlive() const {
80 return shower_->keep_alive_.get() != NULL; 81 return shower_->keep_alive_.get() != NULL;
81 } 82 }
82 83
83 void OnViewCreated() override { ++views_created_; } 84 void OnViewCreated() override { ++views_created_; }
84 void OnViewDismissed() override { ++views_dismissed_; } 85 void OnViewDismissed() override { ++views_dismissed_; }
85 void MoveNearCursor(app_list::AppListView* view) override {} 86 void MoveNearCursor(app_list::AppListView* view) override {}
86 87
87 protected: 88 protected:
88 scoped_ptr<FakeAppListShower> shower_; 89 std::unique_ptr<FakeAppListShower> shower_;
89 scoped_ptr<FakeProfile> profile1_; 90 std::unique_ptr<FakeProfile> profile1_;
90 scoped_ptr<FakeProfile> profile2_; 91 std::unique_ptr<FakeProfile> profile2_;
91 92
92 int views_created_; 93 int views_created_;
93 int views_dismissed_; 94 int views_dismissed_;
94 }; 95 };
95 96
96 TEST_F(AppListShowerUnitTest, Preconditions) { 97 TEST_F(AppListShowerUnitTest, Preconditions) {
97 EXPECT_FALSE(shower_->IsAppListVisible()); 98 EXPECT_FALSE(shower_->IsAppListVisible());
98 EXPECT_FALSE(shower_->HasView()); 99 EXPECT_FALSE(shower_->HasView());
99 EXPECT_FALSE(HasKeepAlive()); 100 EXPECT_FALSE(HasKeepAlive());
100 } 101 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 TEST_F(AppListShowerUnitTest, SwitchingProfiles) { 154 TEST_F(AppListShowerUnitTest, SwitchingProfiles) {
154 shower_->ShowForProfile(profile1_.get()); 155 shower_->ShowForProfile(profile1_.get());
155 EXPECT_EQ("p1", shower_->profile()->GetProfileUserName()); 156 EXPECT_EQ("p1", shower_->profile()->GetProfileUserName());
156 shower_->ShowForProfile(profile2_.get()); 157 shower_->ShowForProfile(profile2_.get());
157 EXPECT_EQ("p2", shower_->profile()->GetProfileUserName()); 158 EXPECT_EQ("p2", shower_->profile()->GetProfileUserName());
158 159
159 // Shouldn't create new view for second profile - it should switch in place. 160 // Shouldn't create new view for second profile - it should switch in place.
160 EXPECT_EQ(1, views_created_); 161 EXPECT_EQ(1, views_created_);
161 EXPECT_EQ(0, views_dismissed_); 162 EXPECT_EQ(0, views_dismissed_);
162 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_shower_views.h ('k') | chrome/browser/ui/app_list/app_list_syncable_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698