diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 03:08:49 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 03:08:49 +0000 |
commit | 39594f64142380e8ed8e06e10deb1396d0fa52dc (patch) | |
tree | f91eff5d77bee32c6c8a8ee95a1a2e958e2a1c7c | |
parent | 8019cf950502180caa60a6cf7b52fc5934745e3f (diff) | |
download | chromium_src-39594f64142380e8ed8e06e10deb1396d0fa52dc.zip chromium_src-39594f64142380e8ed8e06e10deb1396d0fa52dc.tar.gz chromium_src-39594f64142380e8ed8e06e10deb1396d0fa52dc.tar.bz2 |
Revert 222957 "Refactors TestSystemTrayDelegate into DefaultSyst..."
It broke Aura windows builder
FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma\gomacc.exe "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe" /nologo /showIncludes /FC @obj\ash\test\ash_test_support.test_system_tray_delegate.obj.rsp /c ..\..\ash\test\test_system_tray_delegate.cc /Foobj\ash\test\ash_test_support.test_system_tray_delegate.obj /Fdobj\ash\ash_test_support.pdb
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(24) : error C2220: warning treated as error - no 'object' file generated
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(24) : warning C4273: 'ash::test::TestSystemTrayDelegate::TestSystemTrayDelegate' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(15) : see previous definition of '{ctor}'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(28) : warning C4273: 'ash::test::TestSystemTrayDelegate::~TestSystemTrayDelegate' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(16) : see previous definition of '{dtor}'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(33) : warning C4273: 'ash::test::TestSystemTrayDelegate::SetInitialLoginStatus' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(23) : see previous definition of 'SetInitialLoginStatus'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(37) : warning C4273: 'ash::test::TestSystemTrayDelegate::SetLoginStatus' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(30) : see previous definition of 'SetLoginStatus'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(42) : warning C4273: 'ash::test::TestSystemTrayDelegate::GetUserLoginStatus' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(37) : see previous definition of 'GetUserLoginStatus'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(61) : warning C4273: 'ash::test::TestSystemTrayDelegate::ShouldShowDisplayNotification' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(38) : see previous definition of 'ShouldShowDisplayNotification'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(65) : warning C4273: 'ash::test::TestSystemTrayDelegate::ShutDown' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(39) : see previous definition of 'ShutDown'
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.cc(69) : warning C4273: 'ash::test::TestSystemTrayDelegate::SignOut' : inconsistent dll linkage
c:\b\build\slave\win_aura_builder\build\src\ash\test\test_system_tray_delegate.h(40) : see previous definition of 'SignOut'
ninja: build stopped: subcommand failed.
> Refactors TestSystemTrayDelegate into DefaultSystemTrayDelegate
>
> DefaultSystemTrayDelegate is the no-op implementation and
> TestSystemTrayDelegate contains the test related bits.
>
> This also fixes a crash in the windows side as
> TestSystemTrayDelegate::Shutdown() quits the message loop, which is
> the wrong thing to do.
>
> BUG=159693 284358
> TEST=none
> R=oshima@chromium.org
>
> Review URL: https://chromiumcodereview.appspot.com/23465018
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/23650004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222973 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash.gyp | 6 | ||||
-rw-r--r-- | ash/shelf/shelf_widget.cc | 2 | ||||
-rw-r--r-- | ash/shell.cc | 3 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 3 | ||||
-rw-r--r-- | ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc | 2 | ||||
-rw-r--r-- | ash/system/chromeos/tray_display_unittest.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/default_system_tray_delegate.cc | 279 | ||||
-rw-r--r-- | ash/system/tray/system_tray_delegate.cc | 9 | ||||
-rw-r--r-- | ash/system/tray/system_tray_delegate.h | 3 | ||||
-rw-r--r-- | ash/system/tray/test_system_tray_delegate.cc | 312 | ||||
-rw-r--r-- | ash/system/tray/test_system_tray_delegate.h (renamed from ash/system/tray/default_system_tray_delegate.h) | 45 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray_unittest.cc | 2 | ||||
-rw-r--r-- | ash/test/ash_test_helper.cc | 2 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 3 | ||||
-rw-r--r-- | ash/test/test_system_tray_delegate.cc | 74 | ||||
-rw-r--r-- | ash/test/test_system_tray_delegate.h | 52 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_views.cc | 4 |
17 files changed, 372 insertions, 431 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 83e097e..830e9d6 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -297,8 +297,6 @@ 'system/system_notifier.h', 'system/tray/actionable_view.cc', 'system/tray/actionable_view.h', - 'system/tray/default_system_tray_delegate.cc', - 'system/tray/default_system_tray_delegate.h', 'system/tray/fixed_sized_image_view.cc', 'system/tray/fixed_sized_image_view.h', 'system/tray/fixed_sized_scroll_view.cc', @@ -317,6 +315,8 @@ 'system/tray/system_tray_item.h', 'system/tray/system_tray_notifier.cc', 'system/tray/system_tray_notifier.h', + 'system/tray/test_system_tray_delegate.cc', + 'system/tray/test_system_tray_delegate.h', 'system/tray/throbber_view.cc', 'system/tray/throbber_view.h', 'system/tray/tray_background_view.cc', @@ -626,8 +626,6 @@ 'test/test_suite.h', 'test/test_suite_init.h', 'test/test_suite_init.mm', - 'test/test_system_tray_delegate.cc', - 'test/test_system_tray_delegate.h', 'test/ui_controls_factory_ash.cc', 'test/ui_controls_factory_ash.h', ], diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index b5bb8cd..4c187b8 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -16,7 +16,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" -#include "ash/system/tray/system_tray_delegate.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/wm/property_util.h" #include "ash/wm/status_area_layout_manager.h" #include "ash/wm/window_properties.h" diff --git a/ash/shell.cc b/ash/shell.cc index 8b053a7..45af8df 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -597,7 +597,8 @@ void Shell::Init() { // Initialize system_tray_delegate_ before initializing StatusAreaWidget. system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); - DCHECK(system_tray_delegate_.get()); + if (!system_tray_delegate_) + system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate()); internal::RootWindowController* root_window_controller = new internal::RootWindowController(root_window); diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 58076ab..471f5ac 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -16,7 +16,6 @@ #include "ash/shell/launcher_delegate_impl.h" #include "ash/shell/toplevel_window.h" #include "ash/shell_window_ids.h" -#include "ash/system/tray/default_system_tray_delegate.h" #include "ash/wm/window_util.h" #include "base/message_loop/message_loop.h" #include "ui/aura/window.h" @@ -169,7 +168,7 @@ ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( } ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { - return new DefaultSystemTrayDelegate; + return NULL; } ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { diff --git a/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc b/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc index 46f60d1..af7e5d9 100644 --- a/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc +++ b/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc @@ -5,9 +5,9 @@ #include "ash/system/chromeos/managed/tray_locally_managed_user.h" #include "ash/shell.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/system/user/login_status.h" #include "ash/test/ash_test_base.h" -#include "ash/test/test_system_tray_delegate.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h" #include "ui/message_center/notification_list.h" diff --git a/ash/system/chromeos/tray_display_unittest.cc b/ash/system/chromeos/tray_display_unittest.cc index 5a284ab..2a9794c9 100644 --- a/ash/system/chromeos/tray_display_unittest.cc +++ b/ash/system/chromeos/tray_display_unittest.cc @@ -9,8 +9,8 @@ #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/system/tray/system_tray.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/test/ash_test_base.h" -#include "ash/test/test_system_tray_delegate.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "grit/ash_strings.h" diff --git a/ash/system/tray/default_system_tray_delegate.cc b/ash/system/tray/default_system_tray_delegate.cc deleted file mode 100644 index f4f52fa..0000000 --- a/ash/system/tray/default_system_tray_delegate.cc +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2013 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 "ash/system/tray/default_system_tray_delegate.h" - -#include <string> - -#include "ash/session_state_delegate.h" -#include "ash/shell.h" -#include "ash/volume_control_delegate.h" -#include "base/message_loop/message_loop.h" -#include "base/time/time.h" - -namespace ash { - -namespace { - -class DefaultVolumnControlDelegate : public VolumeControlDelegate { - public: - DefaultVolumnControlDelegate() {} - virtual ~DefaultVolumnControlDelegate() {} - - virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE { - return true; - } - virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE { - return true; - } - virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE { - return true; - } - - private: - DISALLOW_COPY_AND_ASSIGN(DefaultVolumnControlDelegate); -}; - -} // namespace - -DefaultSystemTrayDelegate::DefaultSystemTrayDelegate() - : bluetooth_enabled_(true), - volume_control_delegate_(new DefaultVolumnControlDelegate) { -} - -DefaultSystemTrayDelegate::~DefaultSystemTrayDelegate() { -} - -void DefaultSystemTrayDelegate::Initialize() { -} - -void DefaultSystemTrayDelegate::Shutdown() { -} - -bool DefaultSystemTrayDelegate::GetTrayVisibilityOnStartup() { - return true; -} - -user::LoginStatus DefaultSystemTrayDelegate::GetUserLoginStatus() const { - return user::LOGGED_IN_USER; -} - -bool DefaultSystemTrayDelegate::IsOobeCompleted() const { - return true; -} - -void DefaultSystemTrayDelegate::ChangeProfilePicture() { -} - -const std::string DefaultSystemTrayDelegate::GetEnterpriseDomain() const { - return std::string(); -} - -const base::string16 DefaultSystemTrayDelegate::GetEnterpriseMessage() const { - return string16(); -} - -const std::string -DefaultSystemTrayDelegate::GetLocallyManagedUserManager() const { - return std::string(); -} - -const base::string16 -DefaultSystemTrayDelegate::GetLocallyManagedUserManagerName() - const { - return string16(); -} - -const base::string16 DefaultSystemTrayDelegate::GetLocallyManagedUserMessage() - const { - return string16(); -} - -bool DefaultSystemTrayDelegate::SystemShouldUpgrade() const { - return true; -} - -base::HourClockType DefaultSystemTrayDelegate::GetHourClockType() const { - return base::k24HourClock; -} - -void DefaultSystemTrayDelegate::ShowSettings() { -} - -bool DefaultSystemTrayDelegate::ShouldShowSettings() { - return true; -} - -void DefaultSystemTrayDelegate::ShowDateSettings() { -} - -void DefaultSystemTrayDelegate::ShowNetworkSettings( - const std::string& service_path) { -} - -void DefaultSystemTrayDelegate::ShowBluetoothSettings() { -} - -void DefaultSystemTrayDelegate::ShowDisplaySettings() { -} - -void DefaultSystemTrayDelegate::ShowChromeSlow() { -} - -bool DefaultSystemTrayDelegate::ShouldShowDisplayNotification() { - return false; -} - -void DefaultSystemTrayDelegate::ShowDriveSettings() { -} - -void DefaultSystemTrayDelegate::ShowIMESettings() { -} - -void DefaultSystemTrayDelegate::ShowHelp() { -} - -void DefaultSystemTrayDelegate::ShowAccessibilityHelp() { -} - -void DefaultSystemTrayDelegate::ShowAccessibilitySettings() { -} - -void DefaultSystemTrayDelegate::ShowPublicAccountInfo() { -} - -void DefaultSystemTrayDelegate::ShowEnterpriseInfo() { -} - -void DefaultSystemTrayDelegate::ShowLocallyManagedUserInfo() { -} - -void DefaultSystemTrayDelegate::ShowUserLogin() { -} - -void DefaultSystemTrayDelegate::ShutDown() { -} - -void DefaultSystemTrayDelegate::SignOut() { -} - -void DefaultSystemTrayDelegate::RequestLockScreen() { -} - -void DefaultSystemTrayDelegate::RequestRestartForUpdate() { -} - -void DefaultSystemTrayDelegate::GetAvailableBluetoothDevices( - BluetoothDeviceList* list) { -} - -void DefaultSystemTrayDelegate::BluetoothStartDiscovering() { -} - -void DefaultSystemTrayDelegate::BluetoothStopDiscovering() { -} - -void DefaultSystemTrayDelegate::ConnectToBluetoothDevice( - const std::string& address) { -} - -void DefaultSystemTrayDelegate::GetCurrentIME(IMEInfo* info) { -} - -void DefaultSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) { -} - -void DefaultSystemTrayDelegate::GetCurrentIMEProperties( - IMEPropertyInfoList* list) { -} - -void DefaultSystemTrayDelegate::SwitchIME(const std::string& ime_id) { -} - -void DefaultSystemTrayDelegate::ActivateIMEProperty(const std::string& key) { -} - -void DefaultSystemTrayDelegate::CancelDriveOperation(int32 operation_id) { -} - -void DefaultSystemTrayDelegate::GetDriveOperationStatusList( - ash::DriveOperationStatusList*) { -} - -void DefaultSystemTrayDelegate::ConfigureNetwork( - const std::string& network_id) { -} - -void DefaultSystemTrayDelegate::EnrollOrConfigureNetwork( - const std::string& network_id, - gfx::NativeWindow parent_window) { -} - -void DefaultSystemTrayDelegate::ManageBluetoothDevices() { -} - -void DefaultSystemTrayDelegate::ToggleBluetooth() { - bluetooth_enabled_ = !bluetooth_enabled_; -} - -bool DefaultSystemTrayDelegate::IsBluetoothDiscovering() { - return false; -} - -void DefaultSystemTrayDelegate::ShowMobileSimDialog() { -} - -void DefaultSystemTrayDelegate::ShowMobileSetupDialog( - const std::string& service_path) { -} - -void DefaultSystemTrayDelegate::ShowOtherWifi() { -} - -void DefaultSystemTrayDelegate::ShowOtherVPN() { -} - -void DefaultSystemTrayDelegate::ShowOtherCellular() { -} - -bool DefaultSystemTrayDelegate::GetBluetoothAvailable() { - return true; -} - -bool DefaultSystemTrayDelegate::GetBluetoothEnabled() { - return bluetooth_enabled_; -} - -void DefaultSystemTrayDelegate::ChangeProxySettings() { -} - -VolumeControlDelegate* DefaultSystemTrayDelegate::GetVolumeControlDelegate() - const { - return volume_control_delegate_.get(); -} - -void DefaultSystemTrayDelegate::SetVolumeControlDelegate( - scoped_ptr<VolumeControlDelegate> delegate) { - volume_control_delegate_ = delegate.Pass(); -} - -bool DefaultSystemTrayDelegate::GetSessionStartTime( - base::TimeTicks* session_start_time) { - return false; -} - -bool DefaultSystemTrayDelegate::GetSessionLengthLimit( - base::TimeDelta* session_length_limit) { - return false; -} - -int DefaultSystemTrayDelegate::GetSystemTrayMenuWidth() { - // This is the default width for English languages. - return 300; -} - -void DefaultSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const { -} - -} // namespace ash diff --git a/ash/system/tray/system_tray_delegate.cc b/ash/system/tray/system_tray_delegate.cc index 084e158..f31e314 100644 --- a/ash/system/tray/system_tray_delegate.cc +++ b/ash/system/tray/system_tray_delegate.cc @@ -4,6 +4,8 @@ #include "ash/system/tray/system_tray_delegate.h" +#include "ash/system/tray/test_system_tray_delegate.h" + namespace ash { NetworkIconInfo::NetworkIconInfo() @@ -50,4 +52,11 @@ IMEPropertyInfo::IMEPropertyInfo() IMEPropertyInfo::~IMEPropertyInfo() { } +// TODO(stevenjb/oshima): Remove this once Shell::delegate_ is guaranteed +// to not be NULL and move TestSystemTrayDelegate -> ash/test. crbug.com/159693 +// static +SystemTrayDelegate* SystemTrayDelegate::CreateDummyDelegate() { + return new test::TestSystemTrayDelegate; +} + } // namespace ash diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index eac4e6b..8b43562 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -313,6 +313,9 @@ class ASH_EXPORT SystemTrayDelegate { // Speaks the given text if spoken feedback is enabled. virtual void MaybeSpeak(const std::string& utterance) const = 0; + + // Creates a dummy delegate for testing. + static SystemTrayDelegate* CreateDummyDelegate(); }; } // namespace ash diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc new file mode 100644 index 0000000..87ac92c --- /dev/null +++ b/ash/system/tray/test_system_tray_delegate.cc @@ -0,0 +1,312 @@ +// Copyright (c) 2012 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 "ash/system/tray/test_system_tray_delegate.h" + +#include <string> + +#include "ash/session_state_delegate.h" +#include "ash/shell.h" +#include "ash/volume_control_delegate.h" +#include "base/message_loop/message_loop.h" +#include "base/time/time.h" + +namespace ash { +namespace test { + +namespace { + +user::LoginStatus g_initial_status = user::LOGGED_IN_USER; + +class TestVolumeControlDelegate : public VolumeControlDelegate { + public: + TestVolumeControlDelegate() {} + virtual ~TestVolumeControlDelegate() {} + + virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE { + return true; + } + virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE { + return true; + } + virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE { + return true; + } + + private: + DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate); +}; + +} // namespace + +// static +void TestSystemTrayDelegate::SetInitialLoginStatus( + user::LoginStatus login_status) { + g_initial_status = login_status; +} + +TestSystemTrayDelegate::TestSystemTrayDelegate() + : bluetooth_enabled_(true), + caps_lock_enabled_(false), + should_show_display_notification_(false), + login_status_(g_initial_status), + volume_control_delegate_(new TestVolumeControlDelegate) { +} + +TestSystemTrayDelegate::~TestSystemTrayDelegate() { +} + +void TestSystemTrayDelegate::SetLoginStatus(user::LoginStatus login_status) { + login_status_ = login_status; + Shell::GetInstance()->UpdateAfterLoginStatusChange(login_status); +} + +void TestSystemTrayDelegate::Initialize() { +} + +void TestSystemTrayDelegate::Shutdown() { +} + +bool TestSystemTrayDelegate::GetTrayVisibilityOnStartup() { + return true; +} + +// Overridden from SystemTrayDelegate: +user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { + // Initial login status has been changed for testing. + if (g_initial_status != user::LOGGED_IN_USER && + g_initial_status == login_status_) { + return login_status_; + } + + // At new user image screen manager->IsUserLoggedIn() would return true + // but there's no browser session available yet so use SessionStarted(). + SessionStateDelegate* delegate = + Shell::GetInstance()->session_state_delegate(); + + if (!delegate->IsActiveUserSessionStarted()) + return ash::user::LOGGED_IN_NONE; + if (delegate->IsScreenLocked()) + return user::LOGGED_IN_LOCKED; + return login_status_; +} + +bool TestSystemTrayDelegate::IsOobeCompleted() const { + return true; +} + +void TestSystemTrayDelegate::ChangeProfilePicture() { +} + +const std::string TestSystemTrayDelegate::GetEnterpriseDomain() const { + return std::string(); +} + +const base::string16 TestSystemTrayDelegate::GetEnterpriseMessage() const { + return string16(); +} + +const std::string TestSystemTrayDelegate::GetLocallyManagedUserManager() const { + return std::string(); +} + +const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserManagerName() + const { + return string16(); +} + +const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserMessage() + const { + return string16(); +} + +bool TestSystemTrayDelegate::SystemShouldUpgrade() const { + return true; +} + +base::HourClockType TestSystemTrayDelegate::GetHourClockType() const { + return base::k24HourClock; +} + +void TestSystemTrayDelegate::ShowSettings() { +} + +bool TestSystemTrayDelegate::ShouldShowSettings() { + return true; +} + +void TestSystemTrayDelegate::ShowDateSettings() { +} + +void TestSystemTrayDelegate::ShowNetworkSettings( + const std::string& service_path) { +} + +void TestSystemTrayDelegate::ShowBluetoothSettings() { +} + +void TestSystemTrayDelegate::ShowDisplaySettings() { +} + +void TestSystemTrayDelegate::ShowChromeSlow() { +} + +bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { + return should_show_display_notification_; +} + +void TestSystemTrayDelegate::ShowDriveSettings() { +} + +void TestSystemTrayDelegate::ShowIMESettings() { +} + +void TestSystemTrayDelegate::ShowHelp() { +} + +void TestSystemTrayDelegate::ShowAccessibilityHelp() { +} + +void TestSystemTrayDelegate::ShowAccessibilitySettings() { +} + +void TestSystemTrayDelegate::ShowPublicAccountInfo() { +} + +void TestSystemTrayDelegate::ShowEnterpriseInfo() { +} + +void TestSystemTrayDelegate::ShowLocallyManagedUserInfo() { +} + +void TestSystemTrayDelegate::ShowUserLogin() { +} + +void TestSystemTrayDelegate::ShutDown() { + base::MessageLoop::current()->Quit(); +} + +void TestSystemTrayDelegate::SignOut() { + base::MessageLoop::current()->Quit(); +} + +void TestSystemTrayDelegate::RequestLockScreen() { +} + +void TestSystemTrayDelegate::RequestRestartForUpdate() { +} + +void TestSystemTrayDelegate::GetAvailableBluetoothDevices( + BluetoothDeviceList* list) { +} + +void TestSystemTrayDelegate::BluetoothStartDiscovering() { +} + +void TestSystemTrayDelegate::BluetoothStopDiscovering() { +} + +void TestSystemTrayDelegate::ConnectToBluetoothDevice( + const std::string& address) { +} + +void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) { +} + +void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) { +} + +void TestSystemTrayDelegate::GetCurrentIMEProperties( + IMEPropertyInfoList* list) { +} + +void TestSystemTrayDelegate::SwitchIME(const std::string& ime_id) { +} + +void TestSystemTrayDelegate::ActivateIMEProperty(const std::string& key) { +} + +void TestSystemTrayDelegate::CancelDriveOperation(int32 operation_id) { +} + +void TestSystemTrayDelegate::GetDriveOperationStatusList( + ash::DriveOperationStatusList*) { +} + +void TestSystemTrayDelegate::ConfigureNetwork(const std::string& network_id) { +} + +void TestSystemTrayDelegate::EnrollOrConfigureNetwork( + const std::string& network_id, + gfx::NativeWindow parent_window) { +} + +void TestSystemTrayDelegate::ManageBluetoothDevices() { +} + +void TestSystemTrayDelegate::ToggleBluetooth() { + bluetooth_enabled_ = !bluetooth_enabled_; +} + +bool TestSystemTrayDelegate::IsBluetoothDiscovering() { + return false; +} + +void TestSystemTrayDelegate::ShowMobileSimDialog() { +} + +void TestSystemTrayDelegate::ShowMobileSetupDialog( + const std::string& service_path) { +} + +void TestSystemTrayDelegate::ShowOtherWifi() { +} + +void TestSystemTrayDelegate::ShowOtherVPN() { +} + +void TestSystemTrayDelegate::ShowOtherCellular() { +} + +bool TestSystemTrayDelegate::GetBluetoothAvailable() { + return true; +} + +bool TestSystemTrayDelegate::GetBluetoothEnabled() { + return bluetooth_enabled_; +} + +void TestSystemTrayDelegate::ChangeProxySettings() { +} + +VolumeControlDelegate* TestSystemTrayDelegate::GetVolumeControlDelegate() + const { + return volume_control_delegate_.get(); +} + +void TestSystemTrayDelegate::SetVolumeControlDelegate( + scoped_ptr<VolumeControlDelegate> delegate) { + volume_control_delegate_ = delegate.Pass(); +} + +bool TestSystemTrayDelegate::GetSessionStartTime( + base::TimeTicks* session_start_time) { + return false; +} + +bool TestSystemTrayDelegate::GetSessionLengthLimit( + base::TimeDelta* session_length_limit) { + return false; +} + +int TestSystemTrayDelegate::GetSystemTrayMenuWidth() { + // This is the default width for English languages. + return 300; +} + +void TestSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const { +} + +} // namespace test +} // namespace ash diff --git a/ash/system/tray/default_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h index b3edb57..cd9affe 100644 --- a/ash/system/tray/default_system_tray_delegate.h +++ b/ash/system/tray/test_system_tray_delegate.h @@ -1,26 +1,45 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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 ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_ -#define ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_ +#ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ +#define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ #include "ash/ash_export.h" #include "ash/system/tray/system_tray_delegate.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +// TODO(oshima/stevenjb): Move this to ash/test. crbug.com/159693. + namespace ash { +namespace test { -class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate { +class ASH_EXPORT TestSystemTrayDelegate : public SystemTrayDelegate { public: - DefaultSystemTrayDelegate(); - virtual ~DefaultSystemTrayDelegate(); + // Changes the login status when initially the delegate is created. This will + // be called before AshTestBase::SetUp() to test the case when chrome is + // restarted right after the login (such like a flag is set). + // This value will be reset in AshTestHelper::TearDown, most test fixtures + // don't need to care its lifecycle. + static void SetInitialLoginStatus(user::LoginStatus login_status); + + TestSystemTrayDelegate(); + + virtual ~TestSystemTrayDelegate(); + + // Changes the current login status in the test. This also invokes + // UpdateAfterLoginStatusChange(). Usually this is called in the test code to + // set up a login status. This will fit to most of the test cases, but this + // cannot be set during the initialization. To test the initialization, + // consider using SetInitialLoginStatus() instead. + void SetLoginStatus(user::LoginStatus login_status); - // Overridden from SystemTrayDelegate: virtual void Initialize() OVERRIDE; virtual void Shutdown() OVERRIDE; virtual bool GetTrayVisibilityOnStartup() OVERRIDE; + + // Overridden from SystemTrayDelegate: virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE; virtual bool IsOobeCompleted() const OVERRIDE; virtual void ChangeProfilePicture() OVERRIDE; @@ -90,13 +109,21 @@ class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate { virtual int GetSystemTrayMenuWidth() OVERRIDE; virtual void MaybeSpeak(const std::string& utterance) const OVERRIDE; + void set_should_show_display_notification(bool should_show) { + should_show_display_notification_ = should_show; + } + private: bool bluetooth_enabled_; + bool caps_lock_enabled_; + bool should_show_display_notification_; + user::LoginStatus login_status_; scoped_ptr<VolumeControlDelegate> volume_control_delegate_; - DISALLOW_COPY_AND_ASSIGN(DefaultSystemTrayDelegate); + DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); }; +} // namespace test } // namespace ash -#endif // ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_ +#endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index d763a56..ff1728e 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc @@ -14,8 +14,8 @@ #include "ash/system/status_area_widget.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_item.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/test/ash_test_base.h" -#include "ash/test/test_system_tray_delegate.h" #include "ash/wm/window_properties.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index e8ed5db..71af9e5 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -6,11 +6,11 @@ #include "ash/ash_switches.h" #include "ash/shell.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/test/display_manager_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_session_state_delegate.h" #include "ash/test/test_shell_delegate.h" -#include "ash/test/test_system_tray_delegate.h" #include "base/run_loop.h" #include "ui/aura/env.h" #include "ui/base/ime/input_method_initializer.h" diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 4bd6083..bdbdfc8 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -14,7 +14,6 @@ #include "ash/shell_window_ids.h" #include "ash/test/test_launcher_delegate.h" #include "ash/test/test_session_state_delegate.h" -#include "ash/test/test_system_tray_delegate.h" #include "ash/wm/window_util.h" #include "base/logging.h" #include "content/public/test/test_browser_context.h" @@ -158,7 +157,7 @@ LauncherDelegate* TestShellDelegate::CreateLauncherDelegate( } SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { - return new TestSystemTrayDelegate; + return NULL; } UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() { diff --git a/ash/test/test_system_tray_delegate.cc b/ash/test/test_system_tray_delegate.cc deleted file mode 100644 index 0f47aea..0000000 --- a/ash/test/test_system_tray_delegate.cc +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2013 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 "ash/test/test_system_tray_delegate.h" - -#include <string> - -#include "ash/session_state_delegate.h" -#include "ash/shell.h" -#include "base/message_loop/message_loop.h" -#include "base/time/time.h" - -namespace ash { -namespace test { - -namespace { - -user::LoginStatus g_initial_status = user::LOGGED_IN_USER; - -} // namespace - -TestSystemTrayDelegate::TestSystemTrayDelegate() - : should_show_display_notification_(false), - login_status_(g_initial_status) { -} - -TestSystemTrayDelegate::~TestSystemTrayDelegate() { -} - -// static -void TestSystemTrayDelegate::SetInitialLoginStatus( - user::LoginStatus login_status) { - g_initial_status = login_status; -} - -void TestSystemTrayDelegate::SetLoginStatus(user::LoginStatus login_status) { - login_status_ = login_status; - Shell::GetInstance()->UpdateAfterLoginStatusChange(login_status); -} - -user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { - // Initial login status has been changed for testing. - if (g_initial_status != user::LOGGED_IN_USER && - g_initial_status == login_status_) { - return login_status_; - } - - // At new user image screen manager->IsUserLoggedIn() would return true - // but there's no browser session available yet so use SessionStarted(). - SessionStateDelegate* delegate = - Shell::GetInstance()->session_state_delegate(); - - if (!delegate->IsActiveUserSessionStarted()) - return ash::user::LOGGED_IN_NONE; - if (delegate->IsScreenLocked()) - return user::LOGGED_IN_LOCKED; - return login_status_; -} - -bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { - return should_show_display_notification_; -} - -void TestSystemTrayDelegate::ShutDown() { - base::MessageLoop::current()->Quit(); -} - -void TestSystemTrayDelegate::SignOut() { - base::MessageLoop::current()->Quit(); -} - -} // namespace test -} // namespace ash diff --git a/ash/test/test_system_tray_delegate.h b/ash/test/test_system_tray_delegate.h deleted file mode 100644 index 88e5146..0000000 --- a/ash/test/test_system_tray_delegate.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2013 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 ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ -#define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ - -#include "ash/system/tray/default_system_tray_delegate.h" - -namespace ash { -namespace test { - -class ASH_EXPORT TestSystemTrayDelegate : public DefaultSystemTrayDelegate { - public: - TestSystemTrayDelegate(); - virtual ~TestSystemTrayDelegate(); - - // Changes the login status when initially the delegate is created. This will - // be called before AshTestBase::SetUp() to test the case when chrome is - // restarted right after the login (such like a flag is set). - // This value will be reset in AshTestHelper::TearDown, most test fixtures - // don't need to care its lifecycle. - static void SetInitialLoginStatus(user::LoginStatus login_status); - - // Changes the current login status in the test. This also invokes - // UpdateAfterLoginStatusChange(). Usually this is called in the test code to - // set up a login status. This will fit to most of the test cases, but this - // cannot be set during the initialization. To test the initialization, - // consider using SetInitialLoginStatus() instead. - void SetLoginStatus(user::LoginStatus login_status); - - void set_should_show_display_notification(bool should_show) { - should_show_display_notification_ = should_show; - } - - // Overridden from SystemTrayDelegate: - virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE; - virtual bool ShouldShowDisplayNotification() OVERRIDE; - virtual void ShutDown() OVERRIDE; - virtual void SignOut() OVERRIDE; - - private: - bool should_show_display_notification_; - user::LoginStatus login_status_; - - DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); -}; - -} // namespace test -} // namespace ash - -#endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index 1b01998..c7075b2 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc @@ -6,7 +6,6 @@ #include "base/command_line.h" #include "ash/magnifier/magnifier_constants.h" -#include "ash/system/tray/default_system_tray_delegate.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile_manager.h" @@ -104,8 +103,7 @@ void ChromeShellDelegate::SilenceSpokenFeedback() const { } ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { - // TODO(sky): need to subclass and override Shutdown() in a meaningful way. - return new ash::DefaultSystemTrayDelegate; + return NULL; } ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { |