| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 6 |
| 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 13 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 15 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" |
| 16 #include "chromeos/login/login_state.h" |
| 17 #include "components/user_manager/fake_user_manager.h" |
| 18 #include "media/audio/audio_manager.h" |
| 19 #include "media/audio/sounds/sounds_manager.h" |
| 20 |
| 21 namespace chromeos { |
| 22 |
| 23 class SystemTrayDelegateChromeOSTest : public ash::test::AshTestBase { |
| 24 public: |
| 25 SystemTrayDelegateChromeOSTest() |
| 26 : user_manager_enabler_(new user_manager::FakeUserManager) {} |
| 27 ~SystemTrayDelegateChromeOSTest() override { |
| 28 // The system clock must be destroyed before |settings_helper_|. |
| 29 g_browser_process->platform_part()->DestroySystemClock(); |
| 30 } |
| 31 |
| 32 void SetUp() override { |
| 33 input_method::Initialize(); |
| 34 ash::test::AshTestBase::SetUp(); |
| 35 audio_manager_ = media::AudioManager::CreateForTesting( |
| 36 base::ThreadTaskRunnerHandle::Get()); |
| 37 media::SoundsManager::Create(); |
| 38 LoginState::Initialize(); |
| 39 AccessibilityManager::Initialize(); |
| 40 } |
| 41 |
| 42 void TearDown() override { |
| 43 AccessibilityManager::Shutdown(); |
| 44 LoginState::Shutdown(); |
| 45 media::SoundsManager::Shutdown(); |
| 46 ash::test::AshTestBase::TearDown(); |
| 47 input_method::Shutdown(); |
| 48 } |
| 49 |
| 50 private: |
| 51 media::ScopedAudioManagerPtr audio_manager_; |
| 52 ScopedUserManagerEnabler user_manager_enabler_; |
| 53 ScopedCrosSettingsTestHelper settings_helper_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest); |
| 56 }; |
| 57 |
| 58 // Test that checking bluetooth status early on does not cause a crash. |
| 59 TEST_F(SystemTrayDelegateChromeOSTest, BluetoothStatus) { |
| 60 SystemTrayDelegateChromeOS delegate; |
| 61 EXPECT_FALSE(delegate.GetBluetoothAvailable()); |
| 62 EXPECT_FALSE(delegate.GetBluetoothEnabled()); |
| 63 EXPECT_FALSE(delegate.IsBluetoothDiscovering()); |
| 64 } |
| 65 |
| 66 } // namespace chromeos |
| OLD | NEW |