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/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/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 supervised_user_service->set_elevated_for_testing(true); | 324 supervised_user_service->set_elevated_for_testing(true); |
325 | 325 |
326 // Load a content pack. | 326 // Load a content pack. |
327 scoped_refptr<extensions::UnpackedInstaller> installer( | 327 scoped_refptr<extensions::UnpackedInstaller> installer( |
328 extensions::UnpackedInstaller::Create(service_)); | 328 extensions::UnpackedInstaller::Create(service_)); |
329 installer->set_prompt_for_plugins(false); | 329 installer->set_prompt_for_plugins(false); |
330 base::FilePath test_data_dir; | 330 base::FilePath test_data_dir; |
331 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 331 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
332 base::FilePath extension_path = | 332 base::FilePath extension_path = |
333 test_data_dir.AppendASCII("extensions/managed_mode/content_pack"); | 333 test_data_dir.AppendASCII("extensions/supervised_user/content_pack"); |
334 content::WindowedNotificationObserver extension_load_observer( | 334 content::WindowedNotificationObserver extension_load_observer( |
335 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 335 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
336 content::Source<Profile>(profile_.get())); | 336 content::Source<Profile>(profile_.get())); |
337 installer->Load(extension_path); | 337 installer->Load(extension_path); |
338 extension_load_observer.Wait(); | 338 extension_load_observer.Wait(); |
339 observer.Wait(); | 339 observer.Wait(); |
340 content::Details<extensions::Extension> details = | 340 content::Details<extensions::Extension> details = |
341 extension_load_observer.details(); | 341 extension_load_observer.details(); |
342 scoped_refptr<extensions::Extension> extension = | 342 scoped_refptr<extensions::Extension> extension = |
343 make_scoped_refptr(details.ptr()); | 343 make_scoped_refptr(details.ptr()); |
(...skipping 10 matching lines...) Expand all Loading... |
354 EXPECT_EQ(base::string16(), sites[2].name); | 354 EXPECT_EQ(base::string16(), sites[2].name); |
355 | 355 |
356 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, | 356 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, |
357 url_filter->GetFilteringBehaviorForURL(example_url)); | 357 url_filter->GetFilteringBehaviorForURL(example_url)); |
358 EXPECT_EQ(SupervisedUserURLFilter::WARN, | 358 EXPECT_EQ(SupervisedUserURLFilter::WARN, |
359 url_filter->GetFilteringBehaviorForURL(moose_url)); | 359 url_filter->GetFilteringBehaviorForURL(moose_url)); |
360 | 360 |
361 // Load a second content pack. | 361 // Load a second content pack. |
362 installer = extensions::UnpackedInstaller::Create(service_); | 362 installer = extensions::UnpackedInstaller::Create(service_); |
363 extension_path = | 363 extension_path = |
364 test_data_dir.AppendASCII("extensions/managed_mode/content_pack_2"); | 364 test_data_dir.AppendASCII("extensions/supervised_user/content_pack_2"); |
365 installer->Load(extension_path); | 365 installer->Load(extension_path); |
366 observer.Wait(); | 366 observer.Wait(); |
367 | 367 |
368 site_lists = GetActiveSiteLists(supervised_user_service); | 368 site_lists = GetActiveSiteLists(supervised_user_service); |
369 ASSERT_EQ(2u, site_lists.size()); | 369 ASSERT_EQ(2u, site_lists.size()); |
370 sites.clear(); | 370 sites.clear(); |
371 site_lists[0]->GetSites(&sites); | 371 site_lists[0]->GetSites(&sites); |
372 site_lists[1]->GetSites(&sites); | 372 site_lists[1]->GetSites(&sites); |
373 ASSERT_EQ(4u, sites.size()); | 373 ASSERT_EQ(4u, sites.size()); |
374 // The site lists might be returned in any order, so we put them into a set. | 374 // The site lists might be returned in any order, so we put them into a set. |
(...skipping 23 matching lines...) Expand all Loading... |
398 site_lists[0]->GetSites(&sites); | 398 site_lists[0]->GetSites(&sites); |
399 ASSERT_EQ(1u, sites.size()); | 399 ASSERT_EQ(1u, sites.size()); |
400 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name); | 400 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name); |
401 | 401 |
402 EXPECT_EQ(SupervisedUserURLFilter::WARN, | 402 EXPECT_EQ(SupervisedUserURLFilter::WARN, |
403 url_filter->GetFilteringBehaviorForURL(example_url)); | 403 url_filter->GetFilteringBehaviorForURL(example_url)); |
404 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, | 404 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, |
405 url_filter->GetFilteringBehaviorForURL(moose_url)); | 405 url_filter->GetFilteringBehaviorForURL(moose_url)); |
406 } | 406 } |
407 #endif // !defined(OS_ANDROID) | 407 #endif // !defined(OS_ANDROID) |
OLD | NEW |