| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/ref_counted_memory.h" | 19 #include "base/memory/ref_counted_memory.h" |
| 19 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 39 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 40 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 40 #include "chrome/browser/profiles/profile.h" | 41 #include "chrome/browser/profiles/profile.h" |
| 41 #include "chrome/browser/profiles/profile_downloader.h" | 42 #include "chrome/browser/profiles/profile_downloader.h" |
| 42 #include "chrome/browser/signin/account_tracker_service_factory.h" | 43 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 43 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
| 44 #include "chrome/test/base/in_process_browser_test.h" | 45 #include "chrome/test/base/in_process_browser_test.h" |
| 45 #include "chrome/test/base/testing_browser_process.h" | 46 #include "chrome/test/base/testing_browser_process.h" |
| 46 #include "chromeos/chromeos_paths.h" | 47 #include "chromeos/chromeos_paths.h" |
| 48 #include "chromeos/chromeos_switches.h" |
| 47 #include "chromeos/dbus/cryptohome_client.h" | 49 #include "chromeos/dbus/cryptohome_client.h" |
| 48 #include "chromeos/dbus/dbus_thread_manager.h" | 50 #include "chromeos/dbus/dbus_thread_manager.h" |
| 49 #include "chromeos/dbus/fake_session_manager_client.h" | 51 #include "chromeos/dbus/fake_session_manager_client.h" |
| 50 #include "chromeos/dbus/session_manager_client.h" | 52 #include "chromeos/dbus/session_manager_client.h" |
| 51 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 53 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 52 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 54 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 53 #include "components/policy/core/common/cloud/policy_builder.h" | 55 #include "components/policy/core/common/cloud/policy_builder.h" |
| 54 #include "components/prefs/pref_change_registrar.h" | 56 #include "components/prefs/pref_change_registrar.h" |
| 55 #include "components/prefs/pref_service.h" | 57 #include "components/prefs/pref_service.h" |
| 56 #include "components/prefs/scoped_user_pref_update.h" | 58 #include "components/prefs/scoped_user_pref_update.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 enterprise_account_id_(AccountId::FromUserEmail(kEnterpriseUser1)) {} | 112 enterprise_account_id_(AccountId::FromUserEmail(kEnterpriseUser1)) {} |
| 111 | 113 |
| 112 // LoginManagerTest overrides: | 114 // LoginManagerTest overrides: |
| 113 void SetUpInProcessBrowserTestFixture() override { | 115 void SetUpInProcessBrowserTestFixture() override { |
| 114 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 116 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
| 115 | 117 |
| 116 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); | 118 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); |
| 117 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)); | 119 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)); |
| 118 } | 120 } |
| 119 | 121 |
| 122 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 123 LoginManagerTest::SetUpCommandLine(command_line); |
| 124 // These tests create new users and then inject policy after the fact, |
| 125 // to avoid having to set up a mock policy server. UserCloudPolicyManager |
| 126 // will shut down the profile if there's an error loading the initial |
| 127 // policy, so disable this behavior so we can inject policy directly. |
| 128 command_line->AppendSwitch( |
| 129 chromeos::switches::kAllowFailedPolicyFetchForTest); |
| 130 } |
| 131 |
| 120 void SetUpOnMainThread() override { | 132 void SetUpOnMainThread() override { |
| 121 LoginManagerTest::SetUpOnMainThread(); | 133 LoginManagerTest::SetUpOnMainThread(); |
| 122 local_state_ = g_browser_process->local_state(); | 134 local_state_ = g_browser_process->local_state(); |
| 123 user_manager::UserManager::Get()->AddObserver(this); | 135 user_manager::UserManager::Get()->AddObserver(this); |
| 124 } | 136 } |
| 125 | 137 |
| 126 void TearDownOnMainThread() override { | 138 void TearDownOnMainThread() override { |
| 127 user_manager::UserManager::Get()->RemoveObserver(this); | 139 user_manager::UserManager::Get()->RemoveObserver(this); |
| 128 LoginManagerTest::TearDownOnMainThread(); | 140 LoginManagerTest::TearDownOnMainThread(); |
| 129 } | 141 } |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 saved_image = | 940 saved_image = |
| 929 test::ImageLoader(GetUserImagePath(enterprise_account_id_, "jpg")).Load(); | 941 test::ImageLoader(GetUserImagePath(enterprise_account_id_, "jpg")).Load(); |
| 930 ASSERT_TRUE(saved_image); | 942 ASSERT_TRUE(saved_image); |
| 931 | 943 |
| 932 // Check image dimensions. Images can't be compared since JPEG is lossy. | 944 // Check image dimensions. Images can't be compared since JPEG is lossy. |
| 933 EXPECT_EQ(policy_image_->width(), saved_image->width()); | 945 EXPECT_EQ(policy_image_->width(), saved_image->width()); |
| 934 EXPECT_EQ(policy_image_->height(), saved_image->height()); | 946 EXPECT_EQ(policy_image_->height(), saved_image->height()); |
| 935 } | 947 } |
| 936 | 948 |
| 937 } // namespace chromeos | 949 } // namespace chromeos |
| OLD | NEW |