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 "chrome/browser/extensions/api/notification/notification_api.h" | 5 #include "chrome/browser/extensions/api/notification/notification_api.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_function_test_utils.h" | 7 #include "chrome/browser/extensions/extension_function_test_utils.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 | 9 |
10 using extensions::Extension; | 10 using extensions::Extension; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 164 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
165 notification_create_function, | 165 notification_create_function, |
166 "[\"\", " | 166 "[\"\", " |
167 "{" | 167 "{" |
168 "\"templateType\": \"basic\"," | 168 "\"templateType\": \"basic\"," |
169 "\"iconUrl\": \"http://www.google.com/intl/en/chrome/assets/" | 169 "\"iconUrl\": \"http://www.google.com/intl/en/chrome/assets/" |
170 "common/images/chrome_logo_2x.png\"," | 170 "common/images/chrome_logo_2x.png\"," |
171 "\"title\": \"Attention!\"," | 171 "\"title\": \"Attention!\"," |
172 "\"message\": \"Check out Cirque du Soleil\"," | 172 "\"message\": \"Check out Cirque du Soleil\"," |
173 "\"priority\": 1," | 173 "\"priority\": 1," |
174 "\"eventTime\": \"Tue, 15 Nov 1994 12:45:26 GMT\"," | 174 "\"eventTime\": 1234567890.12345678," |
175 "\"buttons\": [" | 175 "\"buttons\": [" |
176 " {" | 176 " {" |
177 " \"title\": \"Up\"," | 177 " \"title\": \"Up\"," |
178 " \"iconUrl\":\"http://www.google.com/logos/2012/\"" | 178 " \"iconUrl\":\"http://www.google.com/logos/2012/\"" |
179 " }," | 179 " }," |
180 " {" | 180 " {" |
181 " \"title\": \"Down\"" // note: no iconUrl | 181 " \"title\": \"Down\"" // note: no iconUrl |
182 " }" | 182 " }" |
183 "]," | 183 "]," |
184 "\"expandedMessage\": \"This is a longer expanded message.\"," | 184 "\"expandedMessage\": \"This is a longer expanded message.\"," |
(...skipping 30 matching lines...) Expand all Loading... |
215 " {\"title\": \"Carla Coe\"," | 215 " {\"title\": \"Carla Coe\"," |
216 " \"message\": \"Just took a look at the proposal\"}," | 216 " \"message\": \"Just took a look at the proposal\"}," |
217 " {\"title\": \"Donna Doe\"," | 217 " {\"title\": \"Donna Doe\"," |
218 " \"message\": \"I see that you went to the conference\"}," | 218 " \"message\": \"I see that you went to the conference\"}," |
219 " {\"title\": \"Frank Foe\"," | 219 " {\"title\": \"Frank Foe\"," |
220 " \"message\": \"I ate Harry's sandwich!\"}," | 220 " \"message\": \"I ate Harry's sandwich!\"}," |
221 " {\"title\": \"Grace Goe\"," | 221 " {\"title\": \"Grace Goe\"," |
222 " \"message\": \"I saw Frank steal a sandwich :-)\"}" | 222 " \"message\": \"I saw Frank steal a sandwich :-)\"}" |
223 "]," | 223 "]," |
224 "\"priority\": 1," | 224 "\"priority\": 1," |
225 "\"eventTime\": \"Fri, 16 Nov 2012 01:17:15 GMT\"" | 225 "\"eventTime\": 1361488019.9999999" |
226 "}]", | 226 "}]", |
227 browser(), utils::NONE)); | 227 browser(), utils::NONE)); |
228 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] | 228 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] |
229 | 229 |
230 std::string notification_id; | 230 std::string notification_id; |
231 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); | 231 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); |
232 ASSERT_TRUE(result->GetAsString(¬ification_id)); | 232 ASSERT_TRUE(result->GetAsString(¬ification_id)); |
233 ASSERT_TRUE(notification_id.length() > 0); | 233 ASSERT_TRUE(notification_id.length() > 0); |
234 } | 234 } |
235 | 235 |
236 IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestEvents) { | 236 IN_PROC_BROWSER_TEST_F(NotificationApiTest, TestEvents) { |
237 ASSERT_TRUE(RunExtensionTest("notification/api/events")) << message_; | 237 ASSERT_TRUE(RunExtensionTest("notification/api/events")) << message_; |
238 } | 238 } |
OLD | NEW |