| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/message_center_tray.h" | 5 #include "ui/message_center/message_center_tray.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/base/models/menu_model.h" | 9 #include "ui/base/models/menu_model.h" |
| 10 #include "ui/message_center/message_center.h" | 10 #include "ui/message_center/message_center.h" |
| 11 #include "ui/message_center/notification.h" | 11 #include "ui/message_center/notification.h" |
| 12 #include "ui/message_center/notification_types.h" | 12 #include "ui/message_center/notification_types.h" |
| 13 | 13 |
| 14 using base::ASCIIToUTF16; | 14 using base::ASCIIToUTF16; |
| 15 | 15 |
| 16 namespace message_center { | 16 namespace message_center { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class MockDelegate : public MessageCenterTrayDelegate { | 19 class MockDelegate : public MessageCenterTrayDelegate { |
| 20 public: | 20 public: |
| 21 MockDelegate() | 21 MockDelegate() |
| 22 : show_popups_success_(true), | 22 : show_popups_success_(true), |
| 23 show_message_center_success_(true), | 23 show_message_center_success_(true), |
| 24 enable_context_menu_(true) {} | 24 enable_context_menu_(true) {} |
| 25 virtual ~MockDelegate() {} | 25 virtual ~MockDelegate() {} |
| 26 virtual void OnMessageCenterTrayChanged() OVERRIDE {} | 26 virtual void OnMessageCenterTrayChanged() override {} |
| 27 virtual bool ShowPopups() OVERRIDE { | 27 virtual bool ShowPopups() override { |
| 28 return show_message_center_success_; | 28 return show_message_center_success_; |
| 29 } | 29 } |
| 30 virtual void HidePopups() OVERRIDE {} | 30 virtual void HidePopups() override {} |
| 31 virtual bool ShowMessageCenter() OVERRIDE { | 31 virtual bool ShowMessageCenter() override { |
| 32 return show_popups_success_; | 32 return show_popups_success_; |
| 33 } | 33 } |
| 34 virtual void HideMessageCenter() OVERRIDE {} | 34 virtual void HideMessageCenter() override {} |
| 35 virtual bool ShowNotifierSettings() OVERRIDE { | 35 virtual bool ShowNotifierSettings() override { |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 virtual bool IsContextMenuEnabled() const OVERRIDE { | 38 virtual bool IsContextMenuEnabled() const override { |
| 39 return enable_context_menu_; | 39 return enable_context_menu_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual MessageCenterTray* GetMessageCenterTray() OVERRIDE { | 42 virtual MessageCenterTray* GetMessageCenterTray() override { |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool show_popups_success_; | 46 bool show_popups_success_; |
| 47 bool show_message_center_success_; | 47 bool show_message_center_success_; |
| 48 bool enable_context_menu_; | 48 bool enable_context_menu_; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(MockDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(MockDelegate); |
| 52 }; | 52 }; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 model = message_center_tray_->CreateNotificationMenuModel( | 303 model = message_center_tray_->CreateNotificationMenuModel( |
| 304 notifier_id2, base::string16()); | 304 notifier_id2, base::string16()); |
| 305 EXPECT_EQ(1, model->GetItemCount()); | 305 EXPECT_EQ(1, model->GetItemCount()); |
| 306 EXPECT_EQ(second_command, model->GetCommandIdAt(0)); | 306 EXPECT_EQ(second_command, model->GetCommandIdAt(0)); |
| 307 | 307 |
| 308 // The command itself is disabled because delegate disables context menu. | 308 // The command itself is disabled because delegate disables context menu. |
| 309 EXPECT_FALSE(model->IsEnabledAt(0)); | 309 EXPECT_FALSE(model->IsEnabledAt(0)); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace message_center | 312 } // namespace message_center |
| OLD | NEW |