Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2507073002: Split ArcSessionManager from ArcAuthService. (Closed)
Patch Set: Fix rebase mistake Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #include "url/origin.h" 189 #include "url/origin.h"
190 190
191 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
192 #include "ash/common/accelerators/accelerator_controller.h" 192 #include "ash/common/accelerators/accelerator_controller.h"
193 #include "ash/common/accelerators/accelerator_table.h" 193 #include "ash/common/accelerators/accelerator_table.h"
194 #include "ash/common/accessibility_types.h" 194 #include "ash/common/accessibility_types.h"
195 #include "ash/common/wm_shell.h" 195 #include "ash/common/wm_shell.h"
196 #include "ash/shell.h" 196 #include "ash/shell.h"
197 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 197 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
198 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 198 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
199 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 199 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
200 #include "chrome/browser/chromeos/login/test/js_checker.h" 200 #include "chrome/browser/chromeos/login/test/js_checker.h"
201 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" 201 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
202 #include "chrome/browser/profiles/profile_manager.h" 202 #include "chrome/browser/profiles/profile_manager.h"
203 #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h" 203 #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h"
204 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 204 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
205 #include "chromeos/audio/cras_audio_handler.h" 205 #include "chromeos/audio/cras_audio_handler.h"
206 #include "chromeos/chromeos_switches.h" 206 #include "chromeos/chromeos_switches.h"
207 #include "chromeos/cryptohome/cryptohome_parameters.h" 207 #include "chromeos/cryptohome/cryptohome_parameters.h"
208 #include "chromeos/dbus/dbus_thread_manager.h" 208 #include "chromeos/dbus/dbus_thread_manager.h"
209 #include "chromeos/dbus/fake_session_manager_client.h" 209 #include "chromeos/dbus/fake_session_manager_client.h"
(...skipping 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 EXPECT_FALSE(display_manager->unified_desktop_enabled()); 3945 EXPECT_FALSE(display_manager->unified_desktop_enabled());
3946 } 3946 }
3947 3947
3948 class ArcPolicyTest : public PolicyTest { 3948 class ArcPolicyTest : public PolicyTest {
3949 public: 3949 public:
3950 ArcPolicyTest() {} 3950 ArcPolicyTest() {}
3951 ~ArcPolicyTest() override {} 3951 ~ArcPolicyTest() override {}
3952 3952
3953 protected: 3953 protected:
3954 void SetUpTest() { 3954 void SetUpTest() {
3955 arc::ArcAuthService::DisableUIForTesting(); 3955 arc::ArcSessionManager::DisableUIForTesting();
3956 3956
3957 browser()->profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); 3957 browser()->profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true);
3958 } 3958 }
3959 3959
3960 void TearDownTest() { 3960 void TearDownTest() { arc::ArcSessionManager::Get()->Shutdown(); }
3961 arc::ArcAuthService::Get()->Shutdown();
3962 }
3963 3961
3964 void SetUpInProcessBrowserTestFixture() override { 3962 void SetUpInProcessBrowserTestFixture() override {
3965 PolicyTest::SetUpInProcessBrowserTestFixture(); 3963 PolicyTest::SetUpInProcessBrowserTestFixture();
3966 fake_session_manager_client_ = new chromeos::FakeSessionManagerClient; 3964 fake_session_manager_client_ = new chromeos::FakeSessionManagerClient;
3967 fake_session_manager_client_->set_arc_available(true); 3965 fake_session_manager_client_->set_arc_available(true);
3968 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( 3966 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
3969 std::unique_ptr<chromeos::SessionManagerClient>( 3967 std::unique_ptr<chromeos::SessionManagerClient>(
3970 fake_session_manager_client_)); 3968 fake_session_manager_client_));
3971 3969
3972 // Inject FakeArcSession here so blocking task runner is not needed. 3970 // Inject FakeArcSession here so blocking task runner is not needed.
3973 auto service = base::MakeUnique<arc::ArcBridgeServiceImpl>(nullptr); 3971 auto service = base::MakeUnique<arc::ArcBridgeServiceImpl>(nullptr);
3974 service->SetArcSessionFactoryForTesting( 3972 service->SetArcSessionFactoryForTesting(
3975 base::Bind(arc::FakeArcSession::Create)); 3973 base::Bind(arc::FakeArcSession::Create));
3976 arc::ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service)); 3974 arc::ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service));
3977 } 3975 }
3978 3976
3979 void SetUpCommandLine(base::CommandLine* command_line) override { 3977 void SetUpCommandLine(base::CommandLine* command_line) override {
3980 // ArcAuthService functionality is available only when Arc is enabled. Use 3978 // ArcSessionManager functionality is available only when Arc is enabled.
3981 // kEnableArc switch that activates it. 3979 // Use kEnableArc switch that activates it.
3982 command_line->AppendSwitch(chromeos::switches::kEnableArc); 3980 command_line->AppendSwitch(chromeos::switches::kEnableArc);
3983 } 3981 }
3984 3982
3985 void SetArcEnabledByPolicy(bool enabled) { 3983 void SetArcEnabledByPolicy(bool enabled) {
3986 PolicyMap policies; 3984 PolicyMap policies;
3987 policies.Set(key::kArcEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 3985 policies.Set(key::kArcEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
3988 POLICY_SOURCE_CLOUD, 3986 POLICY_SOURCE_CLOUD,
3989 base::WrapUnique(new base::FundamentalValue(enabled)), 3987 base::WrapUnique(new base::FundamentalValue(enabled)),
3990 nullptr); 3988 nullptr);
3991 UpdateProviderPolicy(policies); 3989 UpdateProviderPolicy(policies);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
4227 4225
4228 SetEmptyPolicy(); 4226 SetEmptyPolicy();
4229 // Policy not set. 4227 // Policy not set.
4230 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4228 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4231 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4229 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4232 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4230 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4233 } 4231 }
4234 #endif // defined(OS_CHROMEOS) 4232 #endif // defined(OS_CHROMEOS)
4235 4233
4236 } // namespace policy 4234 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chromeos_metrics_provider.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698