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 11 matching lines...) Expand all Loading... |
22 | 22 |
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 void RemoveNotification(const std::string& id, bool by_user) override { |
33 bool by_user) override { | |
34 last_removed_id_ = id; | 33 last_removed_id_ = id; |
35 last_removed_by_user_ = by_user; | 34 last_removed_by_user_ = by_user; |
36 ++remove_count_; | 35 ++remove_count_; |
37 } | 36 } |
38 | 37 |
39 virtual void ClickOnNotificationButton(const std::string& id, | 38 void ClickOnNotificationButton(const std::string& id, |
40 int button_index) override { | 39 int button_index) override { |
41 last_clicked_id_ = id; | 40 last_clicked_id_ = id; |
42 last_clicked_index_ = button_index; | 41 last_clicked_index_ = button_index; |
43 } | 42 } |
44 | 43 |
45 const std::string& last_removed_id() const { return last_removed_id_; } | 44 const std::string& last_removed_id() const { return last_removed_id_; } |
46 bool last_removed_by_user() const { return last_removed_by_user_; } | 45 bool last_removed_by_user() const { return last_removed_by_user_; } |
47 int remove_count() const { return remove_count_; } | 46 int remove_count() const { return remove_count_; } |
48 const std::string& last_clicked_id() const { return last_clicked_id_; } | 47 const std::string& last_clicked_id() const { return last_clicked_id_; } |
49 int last_clicked_index() const { return last_clicked_index_; } | 48 int last_clicked_index() const { return last_clicked_index_; } |
50 | 49 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 notification->set_title(ASCIIToUTF16("one line")); | 430 notification->set_title(ASCIIToUTF16("one line")); |
432 [controller updateNotification:notification.get()]; | 431 [controller updateNotification:notification.get()]; |
433 EXPECT_EQ(1u, compute_message_lines()); | 432 EXPECT_EQ(1u, compute_message_lines()); |
434 | 433 |
435 notification->set_title(ASCIIToUTF16("two\nlines")); | 434 notification->set_title(ASCIIToUTF16("two\nlines")); |
436 [controller updateNotification:notification.get()]; | 435 [controller updateNotification:notification.get()]; |
437 EXPECT_EQ(0u, compute_message_lines()); | 436 EXPECT_EQ(0u, compute_message_lines()); |
438 } | 437 } |
439 | 438 |
440 } // namespace message_center | 439 } // namespace message_center |
OLD | NEW |