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

Unified Diff: chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc

Issue 356673003: Notification Provider API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc
diff --git a/chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc b/chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e0b892c38bbfffc4368e8339d235684779f4b68f
--- /dev/null
+++ b/chrome/browser/extensions/api/notification_provider/notification_provider_apitest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/notification_provider/notification_provider_api.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/extensions/api/notification_provider.h"
+
+typedef ExtensionApiTest NotificationProviderApiTest;
+
+IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, Events) {
+ std::string sender_id1 = "SenderId1";
+ std::string notification_id1 = "NotificationId1";
+ base::DictionaryValue* options_args = new base::DictionaryValue();
+ options_args->SetWithoutPathExpansion("type", new base::StringValue("basic"));
+ 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.
+ new base::StringValue("icon.png"));
+ options_args->SetWithoutPathExpansion("title",
+ new base::StringValue("Title"));
+ options_args->SetWithoutPathExpansion(
+ "message", new base::StringValue("Here goes the message."));
+ extensions::api::notifications::NotificationOptions* options =
+ 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.
+ 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.
+ options);
+
+ ResultCatcher catcher;
+ catcher.RestrictToProfile(browser()->profile());
+
+ // Test notification provider extension
+ const extensions::Extension* extension =
+ LoadExtension(test_data_dir_.AppendASCII("notification_provider/events"));
+ ASSERT_TRUE(extension);
+
+ extensions::NotificationProviderEventRouter* event_router =
+ new extensions::NotificationProviderEventRouter(browser()->profile());
+
+ event_router->CreateNotification(
+ extension->id(), sender_id1, notification_id1, *options);
+ event_router->UpdateNotification(
+ extension->id(), sender_id1, notification_id1, *options);
+ event_router->ClearNotification(
+ extension->id(), sender_id1, notification_id1);
+
+ EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
+}

Powered by Google App Engine
This is Rietveld 408576698