| OLD | NEW |
| 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice.h" | 17 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice.h" |
| 17 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice_factory.h" | 18 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser
vice_factory.h" |
| 18 #include "chrome/browser/supervised_user/permission_request_creator.h" | 19 #include "chrome/browser/supervised_user/permission_request_creator.h" |
| 19 #include "chrome/browser/supervised_user/supervised_user_service.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 CreateDefaultInitParams(); | 368 CreateDefaultInitParams(); |
| 368 params.profile_is_supervised = is_supervised_; | 369 params.profile_is_supervised = is_supervised_; |
| 369 InitializeExtensionService(params); | 370 InitializeExtensionService(params); |
| 370 SupervisedUserService* service = | 371 SupervisedUserService* service = |
| 371 SupervisedUserServiceFactory::GetForProfile(profile_.get()); | 372 SupervisedUserServiceFactory::GetForProfile(profile_.get()); |
| 372 service->Init(); | 373 service->Init(); |
| 373 site_list_observer_.Init(service->GetWhitelistService()); | 374 site_list_observer_.Init(service->GetWhitelistService()); |
| 374 | 375 |
| 375 SupervisedUserURLFilter* url_filter = service->GetURLFilterForUIThread(); | 376 SupervisedUserURLFilter* url_filter = service->GetURLFilterForUIThread(); |
| 376 url_filter->SetBlockingTaskRunnerForTesting( | 377 url_filter->SetBlockingTaskRunnerForTesting( |
| 377 base::MessageLoopProxy::current()); | 378 base::ThreadTaskRunnerHandle::Get()); |
| 378 url_filter_observer_.Init(url_filter); | 379 url_filter_observer_.Init(url_filter); |
| 379 | 380 |
| 380 // Wait for the initial update to finish. | 381 // Wait for the initial update to finish. |
| 381 url_filter_observer_.Wait(); | 382 url_filter_observer_.Wait(); |
| 382 } | 383 } |
| 383 | 384 |
| 384 void TearDown() override { | 385 void TearDown() override { |
| 385 // Flush the message loop, to ensure all posted tasks run. | 386 // Flush the message loop, to ensure all posted tasks run. |
| 386 base::RunLoop().RunUntilIdle(); | 387 base::RunLoop().RunUntilIdle(); |
| 387 } | 388 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 ASSERT_EQ(1u, site_list_observer_.sites().size()); | 577 ASSERT_EQ(1u, site_list_observer_.sites().size()); |
| 577 EXPECT_EQ(base::ASCIIToUTF16("Moose"), site_list_observer_.sites()[0].name); | 578 EXPECT_EQ(base::ASCIIToUTF16("Moose"), site_list_observer_.sites()[0].name); |
| 578 | 579 |
| 579 url_filter_observer_.Wait(); | 580 url_filter_observer_.Wait(); |
| 580 EXPECT_EQ(SupervisedUserURLFilter::WARN, | 581 EXPECT_EQ(SupervisedUserURLFilter::WARN, |
| 581 url_filter->GetFilteringBehaviorForURL(example_url)); | 582 url_filter->GetFilteringBehaviorForURL(example_url)); |
| 582 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, | 583 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, |
| 583 url_filter->GetFilteringBehaviorForURL(moose_url)); | 584 url_filter->GetFilteringBehaviorForURL(moose_url)); |
| 584 } | 585 } |
| 585 #endif // defined(ENABLE_EXTENSIONS) | 586 #endif // defined(ENABLE_EXTENSIONS) |
| OLD | NEW |