OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
25 #include "chrome/test/base/testing_profile_manager.h" | 25 #include "chrome/test/base/testing_profile_manager.h" |
26 #include "content/public/test/test_browser_thread_bundle.h" | 26 #include "content/public/test/test_browser_thread_bundle.h" |
27 #include "extensions/browser/api_test_utils.h" | 27 #include "extensions/browser/api_test_utils.h" |
28 #include "extensions/browser/extension_prefs.h" | 28 #include "extensions/browser/extension_prefs.h" |
29 #include "extensions/browser/extension_system.h" | 29 #include "extensions/browser/extension_system.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
33 #include "ui/message_center/message_center.h" | 33 #include "ui/message_center/message_center.h" |
| 34 #include "ui/message_center/notifier_settings.h" |
34 | 35 |
35 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
36 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 37 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
37 #include "chrome/browser/chromeos/settings/cros_settings.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings.h" |
38 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 39 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
39 #endif | 40 #endif |
40 | 41 |
41 using testing::_; | 42 using testing::_; |
42 using testing::AtMost; | 43 using testing::AtMost; |
43 using testing::Exactly; | 44 using testing::Exactly; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DISALLOW_COPY_AND_ASSIGN(TestBackgroundModeManager); | 116 DISALLOW_COPY_AND_ASSIGN(TestBackgroundModeManager); |
116 }; | 117 }; |
117 | 118 |
118 class TestStatusIcon : public StatusIcon { | 119 class TestStatusIcon : public StatusIcon { |
119 public: | 120 public: |
120 TestStatusIcon() {} | 121 TestStatusIcon() {} |
121 void SetImage(const gfx::ImageSkia& image) override {} | 122 void SetImage(const gfx::ImageSkia& image) override {} |
122 void SetToolTip(const base::string16& tool_tip) override {} | 123 void SetToolTip(const base::string16& tool_tip) override {} |
123 void DisplayBalloon(const gfx::ImageSkia& icon, | 124 void DisplayBalloon(const gfx::ImageSkia& icon, |
124 const base::string16& title, | 125 const base::string16& title, |
125 const base::string16& contents) override {} | 126 const base::string16& contents, |
| 127 const message_center::NotifierId& notifier_id) override {} |
126 void UpdatePlatformContextMenu(StatusIconMenuModel* menu) override {} | 128 void UpdatePlatformContextMenu(StatusIconMenuModel* menu) override {} |
127 | 129 |
128 private: | 130 private: |
129 DISALLOW_COPY_AND_ASSIGN(TestStatusIcon); | 131 DISALLOW_COPY_AND_ASSIGN(TestStatusIcon); |
130 }; | 132 }; |
131 | 133 |
132 void AssertBackgroundModeActive(const TestBackgroundModeManager& manager) { | 134 void AssertBackgroundModeActive(const TestBackgroundModeManager& manager) { |
133 EXPECT_TRUE(chrome::WillKeepAlive()); | 135 EXPECT_TRUE(chrome::WillKeepAlive()); |
134 EXPECT_TRUE(manager.HaveStatusTray()); | 136 EXPECT_TRUE(manager.HaveStatusTray()); |
135 } | 137 } |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 // When the background mode pref is enabled and there are pending triggers | 1031 // When the background mode pref is enabled and there are pending triggers |
1030 // they will be registered and the user will be notified. | 1032 // they will be registered and the user will be notified. |
1031 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); | 1033 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); |
1032 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled, | 1034 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled, |
1033 true); | 1035 true); |
1034 Mock::VerifyAndClearExpectations(&manager); | 1036 Mock::VerifyAndClearExpectations(&manager); |
1035 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_)); | 1037 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_)); |
1036 AssertBackgroundModeActive(manager); | 1038 AssertBackgroundModeActive(manager); |
1037 ASSERT_TRUE(manager.HasShownBalloon()); | 1039 ASSERT_TRUE(manager.HasShownBalloon()); |
1038 } | 1040 } |
OLD | NEW |