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 "base/stringprintf.h" | 5 #include "base/stringprintf.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 7 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 63 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
64 { | 64 { |
65 scoped_refptr<extensions::NotificationsCreateFunction> | 65 scoped_refptr<extensions::NotificationsCreateFunction> |
66 notification_function( | 66 notification_function( |
67 new extensions::NotificationsCreateFunction()); | 67 new extensions::NotificationsCreateFunction()); |
68 | 68 |
69 notification_function->set_extension(empty_extension.get()); | 69 notification_function->set_extension(empty_extension.get()); |
70 notification_function->set_has_callback(true); | 70 notification_function->set_has_callback(true); |
71 | 71 |
72 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 72 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
73 notification_function, | 73 notification_function.get(), |
74 "[\"\", " // Empty string: ask API to generate ID | 74 "[\"\", " // Empty string: ask API to generate ID |
75 "{" | 75 "{" |
76 "\"type\": \"basic\"," | 76 "\"type\": \"basic\"," |
77 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 77 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
78 "\"title\": \"Attention!\"," | 78 "\"title\": \"Attention!\"," |
79 "\"message\": \"Check out Cirque du Soleil\"" | 79 "\"message\": \"Check out Cirque du Soleil\"" |
80 "}]", | 80 "}]", |
81 browser(), utils::NONE)); | 81 browser(), |
| 82 utils::NONE)); |
82 | 83 |
83 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); | 84 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); |
84 ASSERT_TRUE(result->GetAsString(¬ification_id)); | 85 ASSERT_TRUE(result->GetAsString(¬ification_id)); |
85 ASSERT_TRUE(notification_id.length() > 0); | 86 ASSERT_TRUE(notification_id.length() > 0); |
86 } | 87 } |
87 | 88 |
88 // Update the existing notification. | 89 // Update the existing notification. |
89 { | 90 { |
90 scoped_refptr<extensions::NotificationsUpdateFunction> | 91 scoped_refptr<extensions::NotificationsUpdateFunction> |
91 notification_function( | 92 notification_function( |
92 new extensions::NotificationsUpdateFunction()); | 93 new extensions::NotificationsUpdateFunction()); |
93 | 94 |
94 notification_function->set_extension(empty_extension.get()); | 95 notification_function->set_extension(empty_extension.get()); |
95 notification_function->set_has_callback(true); | 96 notification_function->set_has_callback(true); |
96 | 97 |
97 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 98 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
98 notification_function, | 99 notification_function.get(), |
99 "[\"" + notification_id + "\", " | 100 "[\"" + notification_id + |
100 "{" | 101 "\", " |
101 "\"type\": \"basic\"," | 102 "{" |
102 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 103 "\"type\": \"basic\"," |
103 "\"title\": \"Attention!\"," | 104 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
104 "\"message\": \"Too late! The show ended yesterday\"" | 105 "\"title\": \"Attention!\"," |
105 "}]", | 106 "\"message\": \"Too late! The show ended yesterday\"" |
106 browser(), utils::NONE)); | 107 "}]", |
| 108 browser(), |
| 109 utils::NONE)); |
107 | 110 |
108 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 111 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
109 bool copy_bool_value = false; | 112 bool copy_bool_value = false; |
110 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); | 113 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); |
111 ASSERT_TRUE(copy_bool_value); | 114 ASSERT_TRUE(copy_bool_value); |
112 | 115 |
113 // TODO(miket): add a testing method to query the message from the | 116 // TODO(miket): add a testing method to query the message from the |
114 // displayed notification, and assert it matches the updated message. | 117 // displayed notification, and assert it matches the updated message. |
115 // | 118 // |
116 // TODO(miket): add a method to count the number of outstanding | 119 // TODO(miket): add a method to count the number of outstanding |
117 // notifications, and confirm it remains at one at this point. | 120 // notifications, and confirm it remains at one at this point. |
118 } | 121 } |
119 | 122 |
120 // Update a nonexistent notification. | 123 // Update a nonexistent notification. |
121 { | 124 { |
122 scoped_refptr<extensions::NotificationsUpdateFunction> | 125 scoped_refptr<extensions::NotificationsUpdateFunction> |
123 notification_function( | 126 notification_function( |
124 new extensions::NotificationsUpdateFunction()); | 127 new extensions::NotificationsUpdateFunction()); |
125 | 128 |
126 notification_function->set_extension(empty_extension.get()); | 129 notification_function->set_extension(empty_extension.get()); |
127 notification_function->set_has_callback(true); | 130 notification_function->set_has_callback(true); |
128 | 131 |
129 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 132 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
130 notification_function, | 133 notification_function.get(), |
131 "[\"xxxxxxxxxxxx\", " | 134 "[\"xxxxxxxxxxxx\", " |
132 "{" | 135 "{" |
133 "\"type\": \"basic\"," | 136 "\"type\": \"basic\"," |
134 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 137 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
135 "\"title\": \"!\"," | 138 "\"title\": \"!\"," |
136 "\"message\": \"!\"" | 139 "\"message\": \"!\"" |
137 "}]", | 140 "}]", |
138 browser(), utils::NONE)); | 141 browser(), |
| 142 utils::NONE)); |
139 | 143 |
140 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 144 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
141 bool copy_bool_value = false; | 145 bool copy_bool_value = false; |
142 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); | 146 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); |
143 ASSERT_FALSE(copy_bool_value); | 147 ASSERT_FALSE(copy_bool_value); |
144 } | 148 } |
145 | 149 |
146 // Clear a nonexistent notification. | 150 // Clear a nonexistent notification. |
147 { | 151 { |
148 scoped_refptr<extensions::NotificationsClearFunction> | 152 scoped_refptr<extensions::NotificationsClearFunction> |
149 notification_function( | 153 notification_function( |
150 new extensions::NotificationsClearFunction()); | 154 new extensions::NotificationsClearFunction()); |
151 | 155 |
152 notification_function->set_extension(empty_extension.get()); | 156 notification_function->set_extension(empty_extension.get()); |
153 notification_function->set_has_callback(true); | 157 notification_function->set_has_callback(true); |
154 | 158 |
155 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 159 scoped_ptr<base::Value> result( |
156 notification_function, | 160 utils::RunFunctionAndReturnSingleResult(notification_function.get(), |
157 "[\"xxxxxxxxxxx\"]", browser(), utils::NONE)); | 161 "[\"xxxxxxxxxxx\"]", |
| 162 browser(), |
| 163 utils::NONE)); |
158 | 164 |
159 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 165 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
160 bool copy_bool_value = false; | 166 bool copy_bool_value = false; |
161 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); | 167 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); |
162 ASSERT_FALSE(copy_bool_value); | 168 ASSERT_FALSE(copy_bool_value); |
163 } | 169 } |
164 | 170 |
165 // Clear the notification we created. | 171 // Clear the notification we created. |
166 { | 172 { |
167 scoped_refptr<extensions::NotificationsClearFunction> | 173 scoped_refptr<extensions::NotificationsClearFunction> |
168 notification_function( | 174 notification_function( |
169 new extensions::NotificationsClearFunction()); | 175 new extensions::NotificationsClearFunction()); |
170 | 176 |
171 notification_function->set_extension(empty_extension.get()); | 177 notification_function->set_extension(empty_extension.get()); |
172 notification_function->set_has_callback(true); | 178 notification_function->set_has_callback(true); |
173 | 179 |
174 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 180 scoped_ptr<base::Value> result( |
175 notification_function, | 181 utils::RunFunctionAndReturnSingleResult(notification_function.get(), |
176 "[\"" + notification_id + "\"]", browser(), utils::NONE)); | 182 "[\"" + notification_id + "\"]", |
| 183 browser(), |
| 184 utils::NONE)); |
177 | 185 |
178 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 186 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
179 bool copy_bool_value = false; | 187 bool copy_bool_value = false; |
180 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); | 188 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); |
181 ASSERT_TRUE(copy_bool_value); | 189 ASSERT_TRUE(copy_bool_value); |
182 } | 190 } |
183 } | 191 } |
184 | 192 |
185 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestBaseFormatNotification) { | 193 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestBaseFormatNotification) { |
186 scoped_refptr<extensions::NotificationsCreateFunction> | 194 scoped_refptr<extensions::NotificationsCreateFunction> |
187 notification_create_function( | 195 notification_create_function( |
188 new extensions::NotificationsCreateFunction()); | 196 new extensions::NotificationsCreateFunction()); |
189 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 197 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
190 | 198 |
191 notification_create_function->set_extension(empty_extension.get()); | 199 notification_create_function->set_extension(empty_extension.get()); |
192 notification_create_function->set_has_callback(true); | 200 notification_create_function->set_has_callback(true); |
193 | 201 |
194 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 202 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
195 notification_create_function, | 203 notification_create_function.get(), |
196 "[\"\", " | 204 "[\"\", " |
197 "{" | 205 "{" |
198 "\"type\": \"basic\"," | 206 "\"type\": \"basic\"," |
199 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 207 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
200 "\"title\": \"Attention!\"," | 208 "\"title\": \"Attention!\"," |
201 "\"message\": \"Check out Cirque du Soleil\"," | 209 "\"message\": \"Check out Cirque du Soleil\"," |
202 "\"priority\": 1," | 210 "\"priority\": 1," |
203 "\"eventTime\": 1234567890.12345678," | 211 "\"eventTime\": 1234567890.12345678," |
204 "\"buttons\": [" | 212 "\"buttons\": [" |
205 " {" | 213 " {" |
206 " \"title\": \"Up\"," | 214 " \"title\": \"Up\"," |
207 " \"iconUrl\":\"http://www.google.com/logos/2012/\"" | 215 " \"iconUrl\":\"http://www.google.com/logos/2012/\"" |
208 " }," | 216 " }," |
209 " {" | 217 " {" |
210 " \"title\": \"Down\"" // note: no iconUrl | 218 " \"title\": \"Down\"" // note: no iconUrl |
211 " }" | 219 " }" |
212 "]," | 220 "]," |
213 "\"expandedMessage\": \"This is a longer expanded message.\"," | 221 "\"expandedMessage\": \"This is a longer expanded message.\"," |
214 "\"imageUrl\": \"http://www.google.com/logos/2012/election12-hp.jpg\"" | 222 "\"imageUrl\": \"http://www.google.com/logos/2012/election12-hp.jpg\"" |
215 "}]", | 223 "}]", |
216 browser(), utils::NONE)); | 224 browser(), |
| 225 utils::NONE)); |
217 | 226 |
218 std::string notification_id; | 227 std::string notification_id; |
219 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); | 228 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); |
220 ASSERT_TRUE(result->GetAsString(¬ification_id)); | 229 ASSERT_TRUE(result->GetAsString(¬ification_id)); |
221 ASSERT_TRUE(notification_id.length() > 0); | 230 ASSERT_TRUE(notification_id.length() > 0); |
222 } | 231 } |
223 | 232 |
224 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestMultipleItemNotification) { | 233 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestMultipleItemNotification) { |
225 scoped_refptr<extensions::NotificationsCreateFunction> | 234 scoped_refptr<extensions::NotificationsCreateFunction> |
226 notification_create_function( | 235 notification_create_function( |
227 new extensions::NotificationsCreateFunction()); | 236 new extensions::NotificationsCreateFunction()); |
228 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 237 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
229 | 238 |
230 notification_create_function->set_extension(empty_extension.get()); | 239 notification_create_function->set_extension(empty_extension.get()); |
231 notification_create_function->set_has_callback(true); | 240 notification_create_function->set_has_callback(true); |
232 | 241 |
233 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 242 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
234 notification_create_function, | 243 notification_create_function.get(), |
235 "[\"\", " | 244 "[\"\", " |
236 "{" | 245 "{" |
237 "\"type\": \"list\"," | 246 "\"type\": \"list\"," |
238 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 247 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
239 "\"title\": \"Multiple Item Notification Title\"," | 248 "\"title\": \"Multiple Item Notification Title\"," |
240 "\"message\": \"Multiple item notification message.\"," | 249 "\"message\": \"Multiple item notification message.\"," |
241 "\"items\": [" | 250 "\"items\": [" |
242 " {\"title\": \"Brett Boe\"," | 251 " {\"title\": \"Brett Boe\"," |
243 " \"message\": \"This is an important message!\"}," | 252 " \"message\": \"This is an important message!\"}," |
244 " {\"title\": \"Carla Coe\"," | 253 " {\"title\": \"Carla Coe\"," |
245 " \"message\": \"Just took a look at the proposal\"}," | 254 " \"message\": \"Just took a look at the proposal\"}," |
246 " {\"title\": \"Donna Doe\"," | 255 " {\"title\": \"Donna Doe\"," |
247 " \"message\": \"I see that you went to the conference\"}," | 256 " \"message\": \"I see that you went to the conference\"}," |
248 " {\"title\": \"Frank Foe\"," | 257 " {\"title\": \"Frank Foe\"," |
249 " \"message\": \"I ate Harry's sandwich!\"}," | 258 " \"message\": \"I ate Harry's sandwich!\"}," |
250 " {\"title\": \"Grace Goe\"," | 259 " {\"title\": \"Grace Goe\"," |
251 " \"message\": \"I saw Frank steal a sandwich :-)\"}" | 260 " \"message\": \"I saw Frank steal a sandwich :-)\"}" |
252 "]," | 261 "]," |
253 "\"priority\": 1," | 262 "\"priority\": 1," |
254 "\"eventTime\": 1361488019.9999999" | 263 "\"eventTime\": 1361488019.9999999" |
255 "}]", | 264 "}]", |
256 browser(), utils::NONE)); | 265 browser(), |
| 266 utils::NONE)); |
257 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] | 267 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] |
258 | 268 |
259 std::string notification_id; | 269 std::string notification_id; |
260 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); | 270 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); |
261 ASSERT_TRUE(result->GetAsString(¬ification_id)); | 271 ASSERT_TRUE(result->GetAsString(¬ification_id)); |
262 ASSERT_TRUE(notification_id.length() > 0); | 272 ASSERT_TRUE(notification_id.length() > 0); |
263 } | 273 } |
264 | 274 |
265 #if defined(OS_LINUX) | 275 #if defined(OS_LINUX) |
266 #define MAYBE_TestGetAll DISABLED_TestGetAll | 276 #define MAYBE_TestGetAll DISABLED_TestGetAll |
267 #else | 277 #else |
268 #define MAYBE_TestGetAll TestGetAll | 278 #define MAYBE_TestGetAll TestGetAll |
269 #endif | 279 #endif |
270 | 280 |
271 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, MAYBE_TestGetAll) { | 281 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, MAYBE_TestGetAll) { |
272 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 282 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
273 | 283 |
274 { | 284 { |
275 scoped_refptr<extensions::NotificationsGetAllFunction> | 285 scoped_refptr<extensions::NotificationsGetAllFunction> |
276 notification_get_all_function( | 286 notification_get_all_function( |
277 new extensions::NotificationsGetAllFunction()); | 287 new extensions::NotificationsGetAllFunction()); |
278 notification_get_all_function->set_extension(empty_extension.get()); | 288 notification_get_all_function->set_extension(empty_extension.get()); |
279 notification_get_all_function->set_has_callback(true); | 289 notification_get_all_function->set_has_callback(true); |
280 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 290 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
281 notification_get_all_function, "[]", browser(), utils::NONE)); | 291 notification_get_all_function.get(), "[]", browser(), utils::NONE)); |
282 | 292 |
283 base::DictionaryValue* return_value; | 293 base::DictionaryValue* return_value; |
284 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 294 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); |
285 ASSERT_TRUE(result->GetAsDictionary(&return_value)); | 295 ASSERT_TRUE(result->GetAsDictionary(&return_value)); |
286 ASSERT_TRUE(return_value->size() == 0); | 296 ASSERT_TRUE(return_value->size() == 0); |
287 } | 297 } |
288 | 298 |
289 const unsigned int kNotificationsToCreate = 4; | 299 const unsigned int kNotificationsToCreate = 4; |
290 | 300 |
291 for (unsigned int i = 0; i < kNotificationsToCreate; i++) { | 301 for (unsigned int i = 0; i < kNotificationsToCreate; i++) { |
292 scoped_refptr<extensions::NotificationsCreateFunction> | 302 scoped_refptr<extensions::NotificationsCreateFunction> |
293 notification_create_function( | 303 notification_create_function( |
294 new extensions::NotificationsCreateFunction()); | 304 new extensions::NotificationsCreateFunction()); |
295 | 305 |
296 notification_create_function->set_extension(empty_extension.get()); | 306 notification_create_function->set_extension(empty_extension.get()); |
297 notification_create_function->set_has_callback(true); | 307 notification_create_function->set_has_callback(true); |
298 | 308 |
299 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 309 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
300 notification_create_function, | 310 notification_create_function.get(), |
301 base::StringPrintf("[\"identifier-%u\", " | 311 base::StringPrintf("[\"identifier-%u\", " |
302 "{" | 312 "{" |
303 "\"type\": \"basic\"," | 313 "\"type\": \"basic\"," |
304 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," | 314 "\"iconUrl\": \"an/image/that/does/not/exist.png\"," |
305 "\"title\": \"Title\"," | 315 "\"title\": \"Title\"," |
306 "\"message\": \"Message.\"," | 316 "\"message\": \"Message.\"," |
307 "\"priority\": 1," | 317 "\"priority\": 1," |
308 "\"eventTime\": 1361488019.9999999" | 318 "\"eventTime\": 1361488019.9999999" |
309 "}]", | 319 "}]", |
310 i), | 320 i), |
311 browser(), | 321 browser(), |
312 utils::NONE)); | 322 utils::NONE)); |
313 } | 323 } |
314 | 324 |
315 { | 325 { |
316 scoped_refptr<extensions::NotificationsGetAllFunction> | 326 scoped_refptr<extensions::NotificationsGetAllFunction> |
317 notification_get_all_function( | 327 notification_get_all_function( |
318 new extensions::NotificationsGetAllFunction()); | 328 new extensions::NotificationsGetAllFunction()); |
319 notification_get_all_function->set_extension(empty_extension.get()); | 329 notification_get_all_function->set_extension(empty_extension.get()); |
320 notification_get_all_function->set_has_callback(true); | 330 notification_get_all_function->set_has_callback(true); |
321 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 331 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
322 notification_get_all_function, "[]", browser(), utils::NONE)); | 332 notification_get_all_function.get(), "[]", browser(), utils::NONE)); |
323 | 333 |
324 base::DictionaryValue* return_value; | 334 base::DictionaryValue* return_value; |
325 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 335 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); |
326 ASSERT_TRUE(result->GetAsDictionary(&return_value)); | 336 ASSERT_TRUE(result->GetAsDictionary(&return_value)); |
327 ASSERT_EQ(return_value->size(), kNotificationsToCreate); | 337 ASSERT_EQ(return_value->size(), kNotificationsToCreate); |
328 bool dictionary_bool = false; | 338 bool dictionary_bool = false; |
329 for (unsigned int i = 0; i < kNotificationsToCreate; i++) { | 339 for (unsigned int i = 0; i < kNotificationsToCreate; i++) { |
330 std::string id = base::StringPrintf("identifier-%u", i); | 340 std::string id = base::StringPrintf("identifier-%u", i); |
331 ASSERT_TRUE(return_value->GetBoolean(id, &dictionary_bool)); | 341 ASSERT_TRUE(return_value->GetBoolean(id, &dictionary_bool)); |
332 ASSERT_TRUE(dictionary_bool); | 342 ASSERT_TRUE(dictionary_bool); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 381 } |
372 | 382 |
373 { | 383 { |
374 ResultCatcher catcher; | 384 ResultCatcher catcher; |
375 g_browser_process->message_center()->RemoveNotification( | 385 g_browser_process->message_center()->RemoveNotification( |
376 extension->id() + "-BAR", | 386 extension->id() + "-BAR", |
377 true); | 387 true); |
378 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 388 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
379 } | 389 } |
380 } | 390 } |
OLD | NEW |