| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 33 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 namespace message_center { | 36 namespace message_center { |
| 37 | 37 |
| 38 class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest { | 38 class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest { |
| 39 public: | 39 public: |
| 40 MessageCenterNotificationManagerTest() {} | 40 MessageCenterNotificationManagerTest() {} |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 virtual void SetUp() { | 43 void SetUp() override { |
| 44 BrowserWithTestWindowTest::SetUp(); | 44 BrowserWithTestWindowTest::SetUp(); |
| 45 #if !defined(OS_CHROMEOS) | 45 #if !defined(OS_CHROMEOS) |
| 46 // BrowserWithTestWindowTest owns an AshTestHelper on OS_CHROMEOS, which | 46 // BrowserWithTestWindowTest owns an AshTestHelper on OS_CHROMEOS, which |
| 47 // in turn initializes the message center. On other platforms, we need to | 47 // in turn initializes the message center. On other platforms, we need to |
| 48 // initialize it here. | 48 // initialize it here. |
| 49 MessageCenter::Initialize(); | 49 MessageCenter::Initialize(); |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 | 52 |
| 53 // Clear the preference and initialize. | 53 // Clear the preference and initialize. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 69 run_loop_->QuitClosure()); | 69 run_loop_->QuitClosure()); |
| 70 notification_manager()->SetMessageCenterTrayDelegateForTest(delegate_); | 70 notification_manager()->SetMessageCenterTrayDelegateForTest(delegate_); |
| 71 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 72 // First run features are only implemented on Windows, where the | 72 // First run features are only implemented on Windows, where the |
| 73 // notification center is hard to find. | 73 // notification center is hard to find. |
| 74 notification_manager()->SetFirstRunTimeoutForTest( | 74 notification_manager()->SetFirstRunTimeoutForTest( |
| 75 TestTimeouts::tiny_timeout()); | 75 TestTimeouts::tiny_timeout()); |
| 76 #endif | 76 #endif |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual void TearDown() { | 79 void TearDown() override { |
| 80 run_loop_.reset(); | 80 run_loop_.reset(); |
| 81 first_run_pref_.reset(); | 81 first_run_pref_.reset(); |
| 82 profile_manager_.reset(); | 82 profile_manager_.reset(); |
| 83 | 83 |
| 84 #if !defined(OS_CHROMEOS) | 84 #if !defined(OS_CHROMEOS) |
| 85 // Shutdown the message center if we initialized it manually. | 85 // Shutdown the message center if we initialized it manually. |
| 86 MessageCenter::Shutdown(); | 86 MessageCenter::Shutdown(); |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 BrowserWithTestWindowTest::TearDown(); | 89 BrowserWithTestWindowTest::TearDown(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 TestingProfile profile; | 204 TestingProfile profile; |
| 205 notification_manager()->Add(GetANotification("test"), &profile); | 205 notification_manager()->Add(GetANotification("test"), &profile); |
| 206 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 206 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
| 207 run_loop()->RunUntilIdle(); | 207 run_loop()->RunUntilIdle(); |
| 208 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 208 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
| 209 EXPECT_FALSE(DidFirstRunPref()); | 209 EXPECT_FALSE(DidFirstRunPref()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 #endif | 212 #endif |
| 213 } // namespace message_center | 213 } // namespace message_center |
| OLD | NEW |