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

Side by Side Diff: trunk/src/chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc

Issue 469313002: Revert 289532 "Route newly created notifications to notification..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | trunk/src/chrome/browser/extensions/api/notifications/notifications_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_provider/notification_provi der_api.h" 5 #include "chrome/browser/extensions/api/notification_provider/notification_provi der_api.h"
6 6
7 #include "chrome/browser/extensions/chrome_extension_function.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/api/notification_provider.h"
8 11
9 typedef ExtensionApiTest NotificationProviderApiTest; 12 typedef ExtensionApiTest NotificationProviderApiTest;
10 13
14 namespace {
15
16 void CreateNotificationOptionsForTest(
17 extensions::api::notifications::NotificationOptions* options) {
18 options->type = extensions::api::notifications::ParseTemplateType("basic");
19 options->icon_url = scoped_ptr<std::string>(new std::string("icon.png"));
20 options->title = scoped_ptr<std::string>(new std::string("Title"));
21 options->message =
22 scoped_ptr<std::string>(new std::string("Here goes the message"));
23 return;
24 }
25
26 } // namespace
27
11 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, Events) { 28 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, Events) {
12 ASSERT_TRUE(RunExtensionTest("notification_provider/events")) << message_; 29 std::string sender_id1 = "SenderId1";
30 std::string notification_id1 = "NotificationId1";
31
32 scoped_ptr<extensions::api::notifications::NotificationOptions> options(
33 new extensions::api::notifications::NotificationOptions());
34 CreateNotificationOptionsForTest(options.get());
35
36 ResultCatcher catcher;
37 catcher.RestrictToProfile(browser()->profile());
38
39 // Test notification provider extension
40 const extensions::Extension* extension =
41 LoadExtension(test_data_dir_.AppendASCII("notification_provider/events"));
42 ASSERT_TRUE(extension);
43
44 scoped_ptr<extensions::NotificationProviderEventRouter> event_router(
45 new extensions::NotificationProviderEventRouter(browser()->profile()));
46
47 event_router->CreateNotification(
48 extension->id(), sender_id1, notification_id1, *options);
49 event_router->UpdateNotification(
50 extension->id(), sender_id1, notification_id1, *options);
51 event_router->ClearNotification(
52 extension->id(), sender_id1, notification_id1);
53
54 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
13 } 55 }
14 56
15 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, TestBasicUsage) { 57 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, TestBasicUsage) {
16 ASSERT_TRUE(RunExtensionTest("notification_provider/basic_usage")) 58 ASSERT_TRUE(RunExtensionTest("notification_provider/basic_usage"))
17 << message_; 59 << message_;
18 } 60 }
OLDNEW
« no previous file with comments | « no previous file | trunk/src/chrome/browser/extensions/api/notifications/notifications_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698