| 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 #import "ui/message_center/cocoa/notification_controller.h" | 5 #import "ui/message_center/cocoa/notification_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class MockMessageCenter : public message_center::FakeMessageCenter { | 25 class MockMessageCenter : public message_center::FakeMessageCenter { |
| 26 public: | 26 public: |
| 27 MockMessageCenter() | 27 MockMessageCenter() |
| 28 : last_removed_by_user_(false), | 28 : last_removed_by_user_(false), |
| 29 remove_count_(0), | 29 remove_count_(0), |
| 30 last_clicked_index_(-1) {} | 30 last_clicked_index_(-1) {} |
| 31 | 31 |
| 32 virtual void RemoveNotification(const std::string& id, | 32 virtual void RemoveNotification(const std::string& id, |
| 33 bool by_user) OVERRIDE { | 33 bool by_user) override { |
| 34 last_removed_id_ = id; | 34 last_removed_id_ = id; |
| 35 last_removed_by_user_ = by_user; | 35 last_removed_by_user_ = by_user; |
| 36 ++remove_count_; | 36 ++remove_count_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void ClickOnNotificationButton(const std::string& id, | 39 virtual void ClickOnNotificationButton(const std::string& id, |
| 40 int button_index) OVERRIDE { | 40 int button_index) override { |
| 41 last_clicked_id_ = id; | 41 last_clicked_id_ = id; |
| 42 last_clicked_index_ = button_index; | 42 last_clicked_index_ = button_index; |
| 43 } | 43 } |
| 44 | 44 |
| 45 const std::string& last_removed_id() const { return last_removed_id_; } | 45 const std::string& last_removed_id() const { return last_removed_id_; } |
| 46 bool last_removed_by_user() const { return last_removed_by_user_; } | 46 bool last_removed_by_user() const { return last_removed_by_user_; } |
| 47 int remove_count() const { return remove_count_; } | 47 int remove_count() const { return remove_count_; } |
| 48 const std::string& last_clicked_id() const { return last_clicked_id_; } | 48 const std::string& last_clicked_id() const { return last_clicked_id_; } |
| 49 int last_clicked_index() const { return last_clicked_index_; } | 49 int last_clicked_index() const { return last_clicked_index_; } |
| 50 | 50 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 notification->set_title(ASCIIToUTF16("one line")); | 431 notification->set_title(ASCIIToUTF16("one line")); |
| 432 [controller updateNotification:notification.get()]; | 432 [controller updateNotification:notification.get()]; |
| 433 EXPECT_EQ(1u, compute_message_lines()); | 433 EXPECT_EQ(1u, compute_message_lines()); |
| 434 | 434 |
| 435 notification->set_title(ASCIIToUTF16("two\nlines")); | 435 notification->set_title(ASCIIToUTF16("two\nlines")); |
| 436 [controller updateNotification:notification.get()]; | 436 [controller updateNotification:notification.get()]; |
| 437 EXPECT_EQ(0u, compute_message_lines()); | 437 EXPECT_EQ(0u, compute_message_lines()); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace message_center | 440 } // namespace message_center |
| OLD | NEW |