| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
| 29 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
| 30 #include "chromeos/dbus/fake_session_manager_client.h" | 30 #include "chromeos/dbus/fake_session_manager_client.h" |
| 31 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
| 32 #include "components/arc/arc_bridge_service_impl.h" | 32 #include "components/arc/arc_bridge_service_impl.h" |
| 33 #include "components/arc/arc_service_manager.h" | 33 #include "components/arc/arc_service_manager.h" |
| 34 #include "components/arc/test/fake_arc_bridge_bootstrap.h" | 34 #include "components/arc/test/fake_arc_session.h" |
| 35 #include "components/policy/core/common/policy_switches.h" | 35 #include "components/policy/core/common/policy_switches.h" |
| 36 #include "components/prefs/pref_member.h" | 36 #include "components/prefs/pref_member.h" |
| 37 #include "components/prefs/pref_service.h" | 37 #include "components/prefs/pref_service.h" |
| 38 #include "components/signin/core/account_id/account_id.h" | 38 #include "components/signin/core/account_id/account_id.h" |
| 39 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 39 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 40 #include "components/user_manager/user_manager.h" | 40 #include "components/user_manager/user_manager.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 42 #include "url/gurl.h" | 42 #include "url/gurl.h" |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 command_line->AppendSwitch(chromeos::switches::kEnableArc); | 133 command_line->AppendSwitch(chromeos::switches::kEnableArc); |
| 134 chromeos::FakeSessionManagerClient* const fake_session_manager_client = | 134 chromeos::FakeSessionManagerClient* const fake_session_manager_client = |
| 135 new chromeos::FakeSessionManagerClient; | 135 new chromeos::FakeSessionManagerClient; |
| 136 fake_session_manager_client->set_arc_available(true); | 136 fake_session_manager_client->set_arc_available(true); |
| 137 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 137 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
| 138 std::unique_ptr<chromeos::SessionManagerClient>( | 138 std::unique_ptr<chromeos::SessionManagerClient>( |
| 139 fake_session_manager_client)); | 139 fake_session_manager_client)); |
| 140 | 140 |
| 141 // Mock out ARC bridge. | 141 // Mock out ARC bridge. |
| 142 auto service = base::MakeUnique<ArcBridgeServiceImpl>(); | 142 auto service = base::MakeUnique<ArcBridgeServiceImpl>(); |
| 143 service->SetArcBridgeBootstrapFactoryForTesting( | 143 service->SetArcSessionFactoryForTesting(base::Bind(FakeArcSession::Create)); |
| 144 base::Bind(FakeArcBridgeBootstrap::Create)); | |
| 145 ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service)); | 144 ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service)); |
| 146 } | 145 } |
| 147 | 146 |
| 148 void SetUpOnMainThread() override { | 147 void SetUpOnMainThread() override { |
| 149 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( | 148 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( |
| 150 new chromeos::FakeChromeUserManager)); | 149 new chromeos::FakeChromeUserManager)); |
| 151 // Init ArcAuthService for testing. | 150 // Init ArcAuthService for testing. |
| 152 ArcAuthService::DisableUIForTesting(); | 151 ArcAuthService::DisableUIForTesting(); |
| 153 ArcAuthService::EnableCheckAndroidManagementForTesting(); | 152 ArcAuthService::EnableCheckAndroidManagementForTesting(); |
| 154 | 153 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 244 |
| 246 prefs->SetBoolean(prefs::kArcEnabled, true); | 245 prefs->SetBoolean(prefs::kArcEnabled, true); |
| 247 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, | 246 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, |
| 248 base::Time::Max()); | 247 base::Time::Max()); |
| 249 ArcAuthServiceShutdownObserver observer; | 248 ArcAuthServiceShutdownObserver observer; |
| 250 observer.Wait(); | 249 observer.Wait(); |
| 251 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state()); | 250 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state()); |
| 252 } | 251 } |
| 253 | 252 |
| 254 } // namespace arc | 253 } // namespace arc |
| OLD | NEW |