diff options
| author | pbond <pbond@chromium.org> | 2016-03-21 03:57:03 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-21 10:58:24 +0000 |
| commit | 33cc17d626fd54020cacc43e1cf2c08298ae8d52 (patch) | |
| tree | d8c3c58db51276843056424f522df8cc2d6a6748 | |
| parent | adc7b8b7f37f3135c0e5c464680f6e0bb98dfc1c (diff) | |
| download | chromium_src-33cc17d626fd54020cacc43e1cf2c08298ae8d52.zip chromium_src-33cc17d626fd54020cacc43e1cf2c08298ae8d52.tar.gz chromium_src-33cc17d626fd54020cacc43e1cf2c08298ae8d52.tar.bz2 | |
Add ArcEnabled policy implementation
Hide "ARC OptIn" control from Chrome:Settings for enterprise users,
map ArcEnabled policy to ArcEnabled pref.
BUG=582440
Review URL: https://codereview.chromium.org/1684063002
Cr-Commit-Position: refs/heads/master@{#382266}
20 files changed, 251 insertions, 73 deletions
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc index 7dba38b..60802a3 100644 --- a/chrome/browser/chromeos/arc/arc_auth_service.cc +++ b/chrome/browser/chromeos/arc/arc_auth_service.cc @@ -202,24 +202,17 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { profile_, GURL(site_url)); CHECK(storage_partition_); - // In case UI is disabled we assume that ARC is opted-in. - if (!IsOptInVerificationDisabled()) { - pref_change_registrar_.Init(profile_->GetPrefs()); - pref_change_registrar_.Add( - prefs::kArcEnabled, - base::Bind(&ArcAuthService::OnOptInPreferenceChanged, - base::Unretained(this))); - if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { - OnOptInPreferenceChanged(); - } else { - if (!disable_ui_for_testing && profile_->IsNewProfile()) { - PrefServiceSyncableFromProfile(profile_)->AddObserver(this); - OnIsSyncingChanged(); - } - } + pref_change_registrar_.Init(profile_->GetPrefs()); + pref_change_registrar_.Add( + prefs::kArcEnabled, base::Bind(&ArcAuthService::OnOptInPreferenceChanged, + base::Unretained(this))); + if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { + OnOptInPreferenceChanged(); } else { - auth_code_.clear(); - StartArc(); + if (!disable_ui_for_testing && profile_->IsNewProfile()) { + PrefServiceSyncableFromProfile(profile_)->AddObserver(this); + OnIsSyncingChanged(); + } } } @@ -298,16 +291,20 @@ void ArcAuthService::OnOptInPreferenceChanged() { if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { if (state_ != State::ACTIVE) { - CloseUI(); auth_code_.clear(); - if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { - // Need pre-fetch auth code and show OptIn UI if needed. - initial_opt_in_ = true; - SetState(State::FETCHING_CODE); - FetchAuthCode(); + if (!IsOptInVerificationDisabled()) { + CloseUI(); + if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { + // Need pre-fetch auth code and show OptIn UI if needed. + initial_opt_in_ = true; + SetState(State::FETCHING_CODE); + FetchAuthCode(); + } else { + // Ready to start Arc. + StartArc(); + } } else { - // Ready to start Arc. StartArc(); } } diff --git a/chrome/browser/policy/DEPS b/chrome/browser/policy/DEPS index 468cb59..382e9d0 100644 --- a/chrome/browser/policy/DEPS +++ b/chrome/browser/policy/DEPS @@ -1,6 +1,7 @@ include_rules = [ "+chrome", "+chromeos", + "+components/arc/test", "+components/drive/drive_pref_names.h", "+components/user_manager", "+content/public/browser", diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 5ee927f..ba007c9 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc @@ -502,6 +502,9 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { { key::kUnifiedDesktopEnabledByDefault, prefs::kUnifiedDesktopEnabledByDefault, base::Value::TYPE_BOOLEAN }, + { key::kArcEnabled, + prefs::kArcEnabled, + base::Value::TYPE_BOOLEAN }, #endif // defined(OS_CHROMEOS) // Metrics reporting is controlled by a platform specific policy for ChromeOS diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index eb72c63..be00c54 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -191,9 +191,20 @@ #include "ash/shell.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/magnification_manager.h" +#include "chrome/browser/chromeos/arc/arc_auth_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h" +#include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chromeos/audio/cras_audio_handler.h" +#include "chromeos/chromeos_switches.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_session_manager_client.h" +#include "chromeos/dbus/session_manager_client.h" +#include "components/arc/arc_bridge_service.h" +#include "components/arc/arc_bridge_service_impl.h" +#include "components/arc/arc_service_manager.h" +#include "components/arc/test/fake_arc_bridge_bootstrap.h" +#include "components/arc/test/fake_arc_bridge_instance.h" #include "ui/chromeos/accessibility_types.h" #include "ui/keyboard/keyboard_util.h" #include "ui/snapshot/screenshot_grabber.h" @@ -3991,6 +4002,87 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, UnifiedDesktopEnabledByDefault) { UpdateProviderPolicy(policies); EXPECT_FALSE(display_manager->unified_desktop_enabled()); } + +class ArcPolicyTest : public PolicyTest { + public: + ArcPolicyTest() {} + ~ArcPolicyTest() override {} + + protected: + void SetUpTest() { + base::CommandLine::ForCurrentProcess()->AppendSwitch( + chromeos::switches::kDisableArcOptInVerification); + arc::ArcAuthService::DisableUIForTesting(); + + arc::ArcServiceManager::Get()->OnPrimaryUserProfilePrepared( + multi_user_util::GetAccountIdFromProfile(browser()->profile())); + arc::ArcAuthService::Get()->OnPrimaryUserProfilePrepared( + browser()->profile()); + } + + void TearDownTest() { + arc::ArcAuthService::Get()->Shutdown(); + } + + void SetUpInProcessBrowserTestFixture() override { + PolicyTest::SetUpInProcessBrowserTestFixture(); + fake_session_manager_client_ = new chromeos::FakeSessionManagerClient; + fake_session_manager_client_->set_arc_available(true); + chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( + scoped_ptr<chromeos::SessionManagerClient>( + fake_session_manager_client_)); + + fake_arc_bridge_instance_.reset(new arc::FakeArcBridgeInstance); + arc::ArcServiceManager::SetArcBridgeServiceForTesting(make_scoped_ptr( + new arc::ArcBridgeServiceImpl(make_scoped_ptr( + new arc::FakeArcBridgeBootstrap( + fake_arc_bridge_instance_.get()))))); + } + + private: + chromeos::FakeSessionManagerClient *fake_session_manager_client_; + scoped_ptr<arc::FakeArcBridgeInstance> fake_arc_bridge_instance_; + + DISALLOW_COPY_AND_ASSIGN(ArcPolicyTest); +}; + +// Test ArcEnabled policy. +IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcEnabled) { + SetUpTest(); + + const PrefService* const pref = browser()->profile()->GetPrefs(); + const arc::ArcBridgeService* const arc_bridge_service + = arc::ArcBridgeService::Get(); + + // ARC is switched off by default. + EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state()); + EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled)); + + // Enable ARC. + PolicyMap policies; + policies.Set(key::kArcEnabled, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, + new base::FundamentalValue(true), + nullptr); + UpdateProviderPolicy(policies); + EXPECT_TRUE(pref->GetBoolean(prefs::kArcEnabled)); + EXPECT_EQ(arc::ArcBridgeService::State::READY, arc_bridge_service->state()); + + // Disable ARC. + policies.Set(key::kArcEnabled, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, + new base::FundamentalValue(false), + nullptr); + UpdateProviderPolicy(policies); + EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled)); + EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state()); + + TearDownTest(); +} #endif // defined(OS_CHROMEOS) } // namespace policy diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html index 77ee6a1..478ec4d 100644 --- a/chrome/browser/resources/options/browser_options.html +++ b/chrome/browser/resources/options/browser_options.html @@ -222,7 +222,7 @@ </div> </section> <if expr="chromeos"> - <section id="andorid-apps-section" guest-visibility="hidden"> + <section id="android-apps-section" guest-visibility="hidden"> <h3 i18n-content="androidAppsTitle"></h3> <div class="checkbox controlled-setting-with-label"> <label> @@ -230,6 +230,8 @@ metric="Options_AndroidApps" type="checkbox"> <span> <span i18n-content="androidAppsEnabled"></span> + <span class="controlled-setting-indicator" + pref="arc.enabled"></span> </span> </label> </div> diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 2b63e80..60c23a2 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -2327,10 +2327,11 @@ cr.define('options', function() { }; /** - * Hides Android Apps settings when they are not available (ChromeOS only). + * Hides Android Apps settings when they are not available. + * (Chrome OS only). */ BrowserOptions.hideAndroidAppsSection = function() { - var section = $('andorid-apps-section'); + var section = $('android-apps-section'); if (section) section.hidden = true; }; diff --git a/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js b/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js index b7a52858..f4a0d0e 100644 --- a/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js +++ b/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js @@ -44,7 +44,7 @@ GuestModeOptionsUIBrowserTest.prototype = { TEST_F('GuestModeOptionsUIBrowserTest', 'testSections', function() { this.expectHidden($('startup-section')); this.expectHidden($('appearance-section')); - this.expectHidden($('andorid-apps-section')); + this.expectHidden($('android-apps-section')); this.expectHidden($('sync-users-section')); this.expectHidden($('easy-unlock-section')); this.expectHidden($('reset-profile-settings-section')); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 70d029f..a1434cd 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2432,6 +2432,13 @@ }], ['configuration_policy==1', { 'sources': [ '<@(chrome_browser_tests_policy_sources)' ], + 'conditions': [ + ['chromeos==1', { + 'dependencies': [ + '../components/components.gyp:arc_test_support', + ] + }] + ] }], ['enable_web_speech==1', { 'sources': [ '<@(chrome_browser_tests_speech_sources)' ], diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 74de288..179ad7f 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -1073,6 +1073,9 @@ if (!is_android) { chrome_tests_gypi_values.chrome_browser_tests_policy_sources, ".", "//chrome") + if (is_chromeos) { + deps += [ "//components/arc:arc_test_support" ] + } } if (enable_web_speech) { sources += rebase_path( diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index df5ef2e..7ce9e81 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json @@ -2436,7 +2436,10 @@ "ArcEnabled": { "os": ["chromeos"], "can_be_recommended": false, - "test_policy": { "ArcEnabled": false } + "test_policy": { "ArcEnabled": false }, + "pref_mappings": [ + { "pref": "arc.enabled" } + ] }, "ArcApplicationPolicy": { diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc index e66b15b..58ffcd7 100644 --- a/chromeos/dbus/fake_session_manager_client.cc +++ b/chromeos/dbus/fake_session_manager_client.cc @@ -16,8 +16,8 @@ namespace chromeos { FakeSessionManagerClient::FakeSessionManagerClient() : start_device_wipe_call_count_(0), notify_lock_screen_shown_call_count_(0), - notify_lock_screen_dismissed_call_count_(0) { -} + notify_lock_screen_dismissed_call_count_(0), + arc_available_(false) {} FakeSessionManagerClient::~FakeSessionManagerClient() { } @@ -153,19 +153,19 @@ void FakeSessionManagerClient::GetServerBackedStateKeys( void FakeSessionManagerClient::CheckArcAvailability( const ArcCallback& callback) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - base::Bind(callback, false)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, arc_available_)); } void FakeSessionManagerClient::StartArcInstance(const std::string& socket_path, const ArcCallback& callback) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - base::Bind(callback, false)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, arc_available_)); } void FakeSessionManagerClient::StopArcInstance(const ArcCallback& callback) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - base::Bind(callback, false)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, arc_available_)); } const std::string& FakeSessionManagerClient::device_policy() const { diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h index 4150091..e5b594a 100644 --- a/chromeos/dbus/fake_session_manager_client.h +++ b/chromeos/dbus/fake_session_manager_client.h @@ -105,6 +105,8 @@ class FakeSessionManagerClient : public SessionManagerClient { return notify_lock_screen_dismissed_call_count_; } + void set_arc_available(bool available) { arc_available_ = available; } + private: std::string device_policy_; std::map<cryptohome::Identification, std::string> user_policies_; @@ -117,6 +119,8 @@ class FakeSessionManagerClient : public SessionManagerClient { int notify_lock_screen_shown_call_count_; int notify_lock_screen_dismissed_call_count_; + bool arc_available_; + DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient); }; diff --git a/components/arc.gypi b/components/arc.gypi index c25af0a..b9103c7 100644 --- a/components/arc.gypi +++ b/components/arc.gypi @@ -73,6 +73,8 @@ 'sources': [ 'arc/test/fake_app_instance.cc', 'arc/test/fake_app_instance.h', + 'arc/test/fake_arc_bridge_bootstrap.cc', + 'arc/test/fake_arc_bridge_bootstrap.h', 'arc/test/fake_arc_bridge_instance.cc', 'arc/test/fake_arc_bridge_instance.h', 'arc/test/fake_arc_bridge_service.cc', diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 9ee2e06..67ec1fc 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn @@ -88,6 +88,8 @@ static_library("arc_test_support") { sources = [ "test/fake_app_instance.cc", "test/fake_app_instance.h", + "test/fake_arc_bridge_bootstrap.cc", + "test/fake_arc_bridge_bootstrap.h", "test/fake_arc_bridge_instance.cc", "test/fake_arc_bridge_instance.h", "test/fake_arc_bridge_service.cc", diff --git a/components/arc/arc_bridge_bootstrap.cc b/components/arc/arc_bridge_bootstrap.cc index 1d7a94f..c9e44a1 100644 --- a/components/arc/arc_bridge_bootstrap.cc +++ b/components/arc/arc_bridge_bootstrap.cc @@ -341,6 +341,7 @@ void ArcBridgeBootstrapImpl::SetState(State state) { } // namespace ArcBridgeBootstrap::ArcBridgeBootstrap() {} + ArcBridgeBootstrap::~ArcBridgeBootstrap() {} // static diff --git a/components/arc/arc_bridge_service_unittest.cc b/components/arc/arc_bridge_service_unittest.cc index c753f23..e3eae59 100644 --- a/components/arc/arc_bridge_service_unittest.cc +++ b/components/arc/arc_bridge_service_unittest.cc @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <utility> - #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" #include "base/run_loop.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "components/arc/arc_bridge_service_impl.h" +#include "components/arc/test/fake_arc_bridge_bootstrap.h" #include "components/arc/test/fake_arc_bridge_instance.h" #include "ipc/mojo/scoped_ipc_support.h" #include "mojo/public/cpp/system/message_pipe.h" @@ -17,37 +16,6 @@ namespace arc { -namespace { - -// A fake ArcBridgeBootstrap that creates a local connection. -class FakeArcBridgeBootstrap : public ArcBridgeBootstrap { - public: - explicit FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance) - : instance_(instance) {} - ~FakeArcBridgeBootstrap() override {} - - void Start() override { - DCHECK(delegate_); - ArcBridgeInstancePtr instance; - instance_->Bind(mojo::GetProxy(&instance)); - delegate_->OnConnectionEstablished(std::move(instance)); - } - - void Stop() override { - DCHECK(delegate_); - instance_->Unbind(); - delegate_->OnStopped(); - } - - private: - // Owned by the caller. - FakeArcBridgeInstance* instance_; - - DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeBootstrap); -}; - -} // namespace - class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer { public: ArcBridgeTest() : ready_(false) {} diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc index 9688bc3..8f7e248 100644 --- a/components/arc/arc_service_manager.cc +++ b/components/arc/arc_service_manager.cc @@ -24,14 +24,23 @@ namespace { // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. ArcServiceManager* g_arc_service_manager = nullptr; +// This pointer is owned by ArcServiceManager. +ArcBridgeService* g_arc_bridge_service_for_testing = nullptr; + } // namespace -ArcServiceManager::ArcServiceManager() - : arc_bridge_service_( - new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())) { +ArcServiceManager::ArcServiceManager() { DCHECK(!g_arc_service_manager); g_arc_service_manager = this; + if (g_arc_bridge_service_for_testing) { + arc_bridge_service_.reset(g_arc_bridge_service_for_testing); + g_arc_bridge_service_for_testing = nullptr; + } else { + arc_bridge_service_.reset(new ArcBridgeServiceImpl( + ArcBridgeBootstrap::Create())); + } + AddService(make_scoped_ptr(new ArcClipboardBridge(arc_bridge_service()))); AddService( make_scoped_ptr(new ArcCrashCollectorBridge(arc_bridge_service()))); @@ -46,6 +55,9 @@ ArcServiceManager::~ArcServiceManager() { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(g_arc_service_manager == this); g_arc_service_manager = nullptr; + if (g_arc_bridge_service_for_testing) { + delete g_arc_bridge_service_for_testing; + } } // static @@ -74,4 +86,13 @@ void ArcServiceManager::OnPrimaryUserProfilePrepared( new ArcNotificationManager(arc_bridge_service(), account_id))); } +//static +void ArcServiceManager::SetArcBridgeServiceForTesting( + scoped_ptr<ArcBridgeService> arc_bridge_service) { + if (g_arc_bridge_service_for_testing) { + delete g_arc_bridge_service_for_testing; + } + g_arc_bridge_service_for_testing = arc_bridge_service.release(); +} + } // namespace arc diff --git a/components/arc/arc_service_manager.h b/components/arc/arc_service_manager.h index b3a1a6d..5c36f56 100644 --- a/components/arc/arc_service_manager.h +++ b/components/arc/arc_service_manager.h @@ -38,6 +38,10 @@ class ArcServiceManager { // Called when the main profile is initialized after user logs in. void OnPrimaryUserProfilePrepared(const AccountId& account_id); + // Set ArcBridgeService instance for testing. Call before ArcServiceManager + // creation. ArcServiceManager owns |arc_bridge_service|. + static void SetArcBridgeServiceForTesting( + scoped_ptr<ArcBridgeService> arc_bridge_service); private: base::ThreadChecker thread_checker_; scoped_ptr<ArcBridgeService> arc_bridge_service_; diff --git a/components/arc/test/fake_arc_bridge_bootstrap.cc b/components/arc/test/fake_arc_bridge_bootstrap.cc new file mode 100644 index 0000000..d2d80bd --- /dev/null +++ b/components/arc/test/fake_arc_bridge_bootstrap.cc @@ -0,0 +1,33 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/arc/test/fake_arc_bridge_bootstrap.h" + +#include <utility> + +#include "base/logging.h" +#include "components/arc/common/arc_bridge.mojom.h" +#include "components/arc/test/fake_arc_bridge_instance.h" +#include "mojo/public/cpp/bindings/interface_request.h" + +namespace arc { + +FakeArcBridgeBootstrap::FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance) + : instance_(instance) { +} + +void FakeArcBridgeBootstrap::Start() { + DCHECK(delegate_); + ArcBridgeInstancePtr instance; + instance_->Bind(mojo::GetProxy(&instance)); + delegate_->OnConnectionEstablished(std::move(instance)); +} + +void FakeArcBridgeBootstrap::Stop() { + DCHECK(delegate_); + instance_->Unbind(); + delegate_->OnStopped(); +} + +} // namespace arc diff --git a/components/arc/test/fake_arc_bridge_bootstrap.h b/components/arc/test/fake_arc_bridge_bootstrap.h new file mode 100644 index 0000000..feb7d6c --- /dev/null +++ b/components/arc/test/fake_arc_bridge_bootstrap.h @@ -0,0 +1,34 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_ +#define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_ + +#include "base/macros.h" +#include "components/arc/arc_bridge_bootstrap.h" + +namespace arc { + +class FakeArcBridgeInstance; + +// A fake ArcBridgeBootstrap that creates a local connection. +class FakeArcBridgeBootstrap : public ArcBridgeBootstrap { + public: + explicit FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance); + ~FakeArcBridgeBootstrap() override {} + + // ArcBridgeBootstrap: + void Start() override; + void Stop() override; + + private: + // Owned by the caller. + FakeArcBridgeInstance* instance_; + + DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeBootstrap); +}; + +} // namespace arc + +#endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_ |
