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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service_unittest.cc

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "base/path_service.h" 5 #include "base/path_service.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/prefs/scoped_user_pref_update.h" 7 #include "base/prefs/scoped_user_pref_update.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::RunLoop run_loop_; 91 base::RunLoop run_loop_;
92 bool result_; 92 bool result_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(AsyncResultHolder); 94 DISALLOW_COPY_AND_ASSIGN(AsyncResultHolder);
95 }; 95 };
96 96
97 class SupervisedUserServiceTest : public ::testing::Test { 97 class SupervisedUserServiceTest : public ::testing::Test {
98 public: 98 public:
99 SupervisedUserServiceTest() {} 99 SupervisedUserServiceTest() {}
100 100
101 virtual void SetUp() override { 101 void SetUp() override {
102 TestingProfile::Builder builder; 102 TestingProfile::Builder builder;
103 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 103 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
104 BuildFakeProfileOAuth2TokenService); 104 BuildFakeProfileOAuth2TokenService);
105 profile_ = builder.Build(); 105 profile_ = builder.Build();
106 supervised_user_service_ = 106 supervised_user_service_ =
107 SupervisedUserServiceFactory::GetForProfile(profile_.get()); 107 SupervisedUserServiceFactory::GetForProfile(profile_.get());
108 } 108 }
109 109
110 virtual void TearDown() override { 110 void TearDown() override { profile_.reset(); }
111 profile_.reset();
112 }
113 111
114 virtual ~SupervisedUserServiceTest() {} 112 ~SupervisedUserServiceTest() override {}
115 113
116 protected: 114 protected:
117 void AddAccessRequest(const GURL& url, AsyncResultHolder* result_holder) { 115 void AddAccessRequest(const GURL& url, AsyncResultHolder* result_holder) {
118 supervised_user_service_->AddAccessRequest( 116 supervised_user_service_->AddAccessRequest(
119 url, base::Bind(&AsyncResultHolder::SetResult, 117 url, base::Bind(&AsyncResultHolder::SetResult,
120 base::Unretained(result_holder))); 118 base::Unretained(result_holder)));
121 } 119 }
122 120
123 content::TestBrowserThreadBundle thread_bundle_; 121 content::TestBrowserThreadBundle thread_bundle_;
124 scoped_ptr<TestingProfile> profile_; 122 scoped_ptr<TestingProfile> profile_;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 266 }
269 } 267 }
270 268
271 #if defined(ENABLE_EXTENSIONS) 269 #if defined(ENABLE_EXTENSIONS)
272 class SupervisedUserServiceExtensionTestBase 270 class SupervisedUserServiceExtensionTestBase
273 : public extensions::ExtensionServiceTestBase { 271 : public extensions::ExtensionServiceTestBase {
274 public: 272 public:
275 explicit SupervisedUserServiceExtensionTestBase(bool is_supervised) 273 explicit SupervisedUserServiceExtensionTestBase(bool is_supervised)
276 : is_supervised_(is_supervised), 274 : is_supervised_(is_supervised),
277 channel_(chrome::VersionInfo::CHANNEL_DEV) {} 275 channel_(chrome::VersionInfo::CHANNEL_DEV) {}
278 virtual ~SupervisedUserServiceExtensionTestBase() {} 276 ~SupervisedUserServiceExtensionTestBase() override {}
279 277
280 virtual void SetUp() override { 278 void SetUp() override {
281 ExtensionServiceTestBase::SetUp(); 279 ExtensionServiceTestBase::SetUp();
282 ExtensionServiceTestBase::ExtensionServiceInitParams params = 280 ExtensionServiceTestBase::ExtensionServiceInitParams params =
283 CreateDefaultInitParams(); 281 CreateDefaultInitParams();
284 params.profile_is_supervised = is_supervised_; 282 params.profile_is_supervised = is_supervised_;
285 InitializeExtensionService(params); 283 InitializeExtensionService(params);
286 SupervisedUserServiceFactory::GetForProfile(profile_.get())->Init(); 284 SupervisedUserServiceFactory::GetForProfile(profile_.get())->Init();
287 } 285 }
288 286
289 protected: 287 protected:
290 ScopedVector<SupervisedUserSiteList> GetActiveSiteLists( 288 ScopedVector<SupervisedUserSiteList> GetActiveSiteLists(
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 site_lists[0]->GetSites(&sites); 512 site_lists[0]->GetSites(&sites);
515 ASSERT_EQ(1u, sites.size()); 513 ASSERT_EQ(1u, sites.size());
516 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name); 514 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name);
517 515
518 EXPECT_EQ(SupervisedUserURLFilter::WARN, 516 EXPECT_EQ(SupervisedUserURLFilter::WARN,
519 url_filter->GetFilteringBehaviorForURL(example_url)); 517 url_filter->GetFilteringBehaviorForURL(example_url));
520 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, 518 EXPECT_EQ(SupervisedUserURLFilter::ALLOW,
521 url_filter->GetFilteringBehaviorForURL(moose_url)); 519 url_filter->GetFilteringBehaviorForURL(moose_url));
522 } 520 }
523 #endif // defined(ENABLE_EXTENSIONS) 521 #endif // defined(ENABLE_EXTENSIONS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698