Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/extensions/api/custom_notification_center/custom_notification_center_apitest.cc

Issue 356673003: Notification Provider API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bug fix Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/custom_notification_center/custom_notifi cation_center_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/custom_notification_center.h"
10
11 typedef ExtensionApiTest CustomNotificationCenterApiTest;
12
13 IN_PROC_BROWSER_TEST_F(CustomNotificationCenterApiTest, Events) {
14 std::string sender_id1 = "SenderId1";
15 std::string notification_id1 = "NotificationId1";
16 base::DictionaryValue* content_args = new base::DictionaryValue();
17 content_args->SetWithoutPathExpansion("type", new base::StringValue("basic"));
18 content_args->SetWithoutPathExpansion("inconUrl",
19 new base::StringValue("icon.png"));
20 content_args->SetWithoutPathExpansion("title",
21 new base::StringValue("Title"));
22 content_args->SetWithoutPathExpansion(
23 "message", new base::StringValue("Here goes the message."));
24 extensions::api::custom_notification_center::NotificationContent* content =
25 new extensions::api::custom_notification_center::NotificationContent();
26 extensions::api::custom_notification_center::NotificationContent::Populate(
27 *content_args, content);
28
29 ResultCatcher catcher;
30 catcher.RestrictToProfile(browser()->profile());
31
32 // Test custom notification center extension
33 const extensions::Extension* extension = LoadExtension(
34 test_data_dir_.AppendASCII("custom_notification_center/events"));
35 ASSERT_TRUE(extension);
36
37 extensions::CustomNotificationCenterEventRouter* event_router =
38 new extensions::CustomNotificationCenterEventRouter(browser()->profile());
39
40 event_router->CreateNotification(
41 extension->id(), sender_id1, notification_id1, *content);
42 event_router->UpdateNotification(
43 extension->id(), sender_id1, notification_id1, *content);
44 event_router->ClearNotification(
45 extension->id(), sender_id1, notification_id1);
46
47 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698