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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void Close(bool by_user) OVERRIDE { | 80 virtual void Close(bool by_user) OVERRIDE { |
81 log_ += "Close_"; | 81 log_ += "Close_"; |
82 log_ += ( by_user ? "by_user_" : "programmatically_"); | 82 log_ += ( by_user ? "by_user_" : "programmatically_"); |
83 } | 83 } |
84 virtual void Click() OVERRIDE { log_ += "Click_"; } | 84 virtual void Click() OVERRIDE { log_ += "Click_"; } |
85 virtual void ButtonClick(int button_index) OVERRIDE { | 85 virtual void ButtonClick(int button_index) OVERRIDE { |
86 log_ += "ButtonClick_"; | 86 log_ += "ButtonClick_"; |
87 log_ += base::IntToString(button_index) + "_"; | 87 log_ += base::IntToString(button_index) + "_"; |
88 } | 88 } |
89 virtual std::string id() const OVERRIDE { return id_; } | 89 virtual std::string id() const OVERRIDE { return id_; } |
90 virtual content::WebContents* GetWebContents() const OVERRIDE { | |
91 return NULL; | |
92 } | |
93 | 90 |
94 const std::string& log() { return log_; } | 91 const std::string& log() { return log_; } |
95 | 92 |
96 private: | 93 private: |
97 virtual ~TestDelegate() {} | 94 virtual ~TestDelegate() {} |
98 std::string id_; | 95 std::string id_; |
99 std::string log_; | 96 std::string log_; |
100 | 97 |
101 DISALLOW_COPY_AND_ASSIGN(TestDelegate); | 98 DISALLOW_COPY_AND_ASSIGN(TestDelegate); |
102 }; | 99 }; |
103 | 100 |
104 Notification CreateTestNotification(const std::string& id, | 101 Notification CreateTestNotification(const std::string& id, |
105 TestDelegate** delegate = NULL) { | 102 TestDelegate** delegate = NULL) { |
106 TestDelegate* new_delegate = new TestDelegate(id); | 103 TestDelegate* new_delegate = new TestDelegate(id); |
107 if (delegate) { | 104 if (delegate) { |
108 *delegate = new_delegate; | 105 *delegate = new_delegate; |
109 new_delegate->AddRef(); | 106 new_delegate->AddRef(); |
110 } | 107 } |
111 | 108 |
112 return Notification(GURL("chrome-test://testing/"), | 109 return Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
113 gfx::Image(), | 110 GURL("chrome-test://testing/"), |
114 base::ASCIIToUTF16("title"), | 111 base::ASCIIToUTF16("title"), |
115 base::ASCIIToUTF16("message"), | 112 base::ASCIIToUTF16("message"), |
| 113 gfx::Image(), |
116 blink::WebTextDirectionDefault, | 114 blink::WebTextDirectionDefault, |
| 115 message_center::NotifierId(), |
117 base::UTF8ToUTF16("chrome-test://testing/"), | 116 base::UTF8ToUTF16("chrome-test://testing/"), |
118 base::UTF8ToUTF16("REPLACE-ME"), | 117 base::UTF8ToUTF16("REPLACE-ME"), |
| 118 message_center::RichNotificationData(), |
119 new_delegate); | 119 new_delegate); |
120 } | 120 } |
121 | 121 |
122 Notification CreateRichTestNotification(const std::string& id, | 122 Notification CreateRichTestNotification(const std::string& id, |
123 TestDelegate** delegate = NULL) { | 123 TestDelegate** delegate = NULL) { |
124 TestDelegate* new_delegate = new TestDelegate(id); | 124 TestDelegate* new_delegate = new TestDelegate(id); |
125 if (delegate) { | 125 if (delegate) { |
126 *delegate = new_delegate; | 126 *delegate = new_delegate; |
127 new_delegate->AddRef(); | 127 new_delegate->AddRef(); |
128 } | 128 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Cast so that Observe() is public. | 362 // Cast so that Observe() is public. |
363 content::NotificationObserver* observer = | 363 content::NotificationObserver* observer = |
364 static_cast<content::NotificationObserver*>(manager()); | 364 static_cast<content::NotificationObserver*>(manager()); |
365 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 365 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
366 content::Source<Profile>(profile()), | 366 content::Source<Profile>(profile()), |
367 content::Details<bool>(&is_fullscreen)); | 367 content::Details<bool>(&is_fullscreen)); |
368 EXPECT_FALSE(message_center()->HasPopupNotifications()); | 368 EXPECT_FALSE(message_center()->HasPopupNotifications()); |
369 } | 369 } |
370 | 370 |
371 #endif // !defined(OS_MACOSX) | 371 #endif // !defined(OS_MACOSX) |
OLD | NEW |