Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/api/notification_provider/notification_provi der_api.h" | |
| 6 #include "chrome/browser/extensions/chrome_extension_function.h" | |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | |
| 8 #include "chrome/browser/profiles/profile.h" | |
| 9 #include "chrome/common/extensions/api/notification_provider.h" | |
| 10 | |
| 11 typedef ExtensionApiTest NotificationProviderApiTest; | |
| 12 | |
| 13 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, Events) { | |
| 14 std::string sender_id1 = "SenderId1"; | |
| 15 std::string notification_id1 = "NotificationId1"; | |
| 16 base::DictionaryValue* options_args = new base::DictionaryValue(); | |
| 17 options_args->SetWithoutPathExpansion("type", new base::StringValue("basic")); | |
| 18 options_args->SetWithoutPathExpansion("inconUrl", | |
|
not at google - send to devlin
2014/07/29 20:09:38
typo. but hopefully moot.
liyanhou
2014/07/30 17:19:25
Done.
| |
| 19 new base::StringValue("icon.png")); | |
| 20 options_args->SetWithoutPathExpansion("title", | |
| 21 new base::StringValue("Title")); | |
| 22 options_args->SetWithoutPathExpansion( | |
| 23 "message", new base::StringValue("Here goes the message.")); | |
| 24 extensions::api::notifications::NotificationOptions* options = | |
| 25 new extensions::api::notifications::NotificationOptions(); | |
|
not at google - send to devlin
2014/07/29 20:09:38
this is new'd but I don't see it free'd anywhere?
liyanhou
2014/07/30 17:19:25
Done.
| |
| 26 extensions::api::notifications::NotificationOptions::Populate(*options_args, | |
|
not at google - send to devlin
2014/07/29 20:09:38
setting up a dictionary and then using Populate on
liyanhou
2014/07/30 17:19:25
Done.
| |
| 27 options); | |
| 28 | |
| 29 ResultCatcher catcher; | |
| 30 catcher.RestrictToProfile(browser()->profile()); | |
| 31 | |
| 32 // Test notification provider extension | |
| 33 const extensions::Extension* extension = | |
| 34 LoadExtension(test_data_dir_.AppendASCII("notification_provider/events")); | |
| 35 ASSERT_TRUE(extension); | |
| 36 | |
| 37 extensions::NotificationProviderEventRouter* event_router = | |
| 38 new extensions::NotificationProviderEventRouter(browser()->profile()); | |
| 39 | |
| 40 event_router->CreateNotification( | |
| 41 extension->id(), sender_id1, notification_id1, *options); | |
| 42 event_router->UpdateNotification( | |
| 43 extension->id(), sender_id1, notification_id1, *options); | |
| 44 event_router->ClearNotification( | |
| 45 extension->id(), sender_id1, notification_id1); | |
| 46 | |
| 47 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 48 } | |
| OLD | NEW |