| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/json/json_file_value_serializer.h" | 14 #include "base/json/json_file_value_serializer.h" |
| 15 #include "base/json/json_reader.h" | 15 #include "base/json/json_reader.h" |
| 16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/sequenced_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/test/scoped_path_override.h" | 23 #include "base/test/scoped_path_override.h" |
| 24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | |
| 27 #include "chrome/browser/profiles/profile_attributes_storage.h" | 26 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 28 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/features.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/test/base/testing_browser_process.h" | 30 #include "chrome/test/base/testing_browser_process.h" |
| 31 #include "chrome/test/base/testing_profile_manager.h" | 31 #include "chrome/test/base/testing_profile_manager.h" |
| 32 #include "components/component_updater/component_updater_paths.h" | 32 #include "components/component_updater/component_updater_paths.h" |
| 33 #include "components/component_updater/component_updater_service.h" | 33 #include "components/component_updater/component_updater_service.h" |
| 34 #include "components/crx_file/id_util.h" | 34 #include "components/crx_file/id_util.h" |
| 35 #include "components/prefs/testing_pref_service.h" | 35 #include "components/prefs/testing_pref_service.h" |
| 36 #include "components/safe_json/testing_json_parser.h" | 36 #include "components/safe_json/testing_json_parser.h" |
| 37 #include "components/update_client/crx_update_item.h" | 37 #include "components/update_client/crx_update_item.h" |
| 38 #include "components/update_client/update_client.h" | 38 #include "components/update_client/update_client.h" |
| 39 #include "components/update_client/utils.h" | 39 #include "components/update_client/utils.h" |
| 40 #include "content/public/test/test_browser_thread_bundle.h" | 40 #include "content/public/test/test_browser_thread_bundle.h" |
| 41 #include "testing/gmock/include/gmock/gmock.h" | 41 #include "testing/gmock/include/gmock/gmock.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
| 43 | 43 |
| 44 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 45 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
| 46 #endif |
| 47 |
| 44 using update_client::CrxComponent; | 48 using update_client::CrxComponent; |
| 45 using update_client::CrxUpdateItem; | 49 using update_client::CrxUpdateItem; |
| 46 | 50 |
| 47 namespace component_updater { | 51 namespace component_updater { |
| 48 | 52 |
| 49 namespace { | 53 namespace { |
| 50 | 54 |
| 51 const char kClientId[] = "client-id"; | 55 const char kClientId[] = "client-id"; |
| 52 const char kCrxId[] = "abcdefghijklmnopponmlkjihgfedcba"; | 56 const char kCrxId[] = "abcdefghijklmnopponmlkjihgfedcba"; |
| 53 const char kName[] = "Some Whitelist"; | 57 const char kName[] = "Some Whitelist"; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // but it exercises a different code path. | 434 // but it exercises a different code path. |
| 431 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId)); | 435 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId)); |
| 432 run_loop.RunUntilIdle(); | 436 run_loop.RunUntilIdle(); |
| 433 } | 437 } |
| 434 EXPECT_FALSE(component_update_service_.registered_component()); | 438 EXPECT_FALSE(component_update_service_.registered_component()); |
| 435 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_)); | 439 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_)); |
| 436 EXPECT_FALSE(base::PathExists(whitelist_path_)); | 440 EXPECT_FALSE(base::PathExists(whitelist_path_)); |
| 437 } | 441 } |
| 438 | 442 |
| 439 } // namespace component_updater | 443 } // namespace component_updater |
| OLD | NEW |