OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <deque> | 5 #include <deque> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 #if ENABLE_MESSAGE_CENTER_TESTING | 70 #if ENABLE_MESSAGE_CENTER_TESTING |
71 class MessageCenterChangeObserver | 71 class MessageCenterChangeObserver |
72 : public message_center::MessageCenter::Observer { | 72 : public message_center::MessageCenter::Observer { |
73 public: | 73 public: |
74 MessageCenterChangeObserver() | 74 MessageCenterChangeObserver() |
75 : notification_received_(false) { | 75 : notification_received_(false) { |
76 message_center::MessageCenter::Get()->AddObserver(this); | 76 message_center::MessageCenter::Get()->AddObserver(this); |
77 } | 77 } |
78 | 78 |
79 ~MessageCenterChangeObserver() { | 79 virtual ~MessageCenterChangeObserver() { |
80 message_center::MessageCenter::Get()->RemoveObserver(this); | 80 message_center::MessageCenter::Get()->RemoveObserver(this); |
81 } | 81 } |
82 | 82 |
83 bool Wait() { | 83 bool Wait() { |
84 if (notification_received_) | 84 if (notification_received_) |
85 return true; | 85 return true; |
86 | 86 |
87 message_loop_runner_ = new content::MessageLoopRunner; | 87 message_loop_runner_ = new content::MessageLoopRunner; |
88 message_loop_runner_->Run(); | 88 message_loop_runner_->Run(); |
89 return notification_received_; | 89 return notification_received_; |
90 } | 90 } |
91 | 91 |
92 virtual void OnMessageCenterChanged(bool new_notification) { | 92 virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE { |
93 notification_received_ = true; | 93 notification_received_ = true; |
94 if (message_loop_runner_) | 94 if (message_loop_runner_) |
95 message_loop_runner_->Quit(); | 95 message_loop_runner_->Quit(); |
96 } | 96 } |
97 | 97 |
98 bool notification_received_; | 98 bool notification_received_; |
99 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 99 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(MessageCenterChangeObserver); | 101 DISALLOW_COPY_AND_ASSIGN(MessageCenterChangeObserver); |
102 }; | 102 }; |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 Balloon* balloon = balloons[0]; | 882 Balloon* balloon = balloons[0]; |
883 const Notification& notification = balloon->notification(); | 883 const Notification& notification = balloon->notification(); |
884 GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); | 884 GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); |
885 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); | 885 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); |
886 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); | 886 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); |
887 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.body()); | 887 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.body()); |
888 #endif | 888 #endif |
889 } | 889 } |
890 | 890 |
891 #endif // !defined(OS_CHROMEOS) | 891 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |