| Index: chrome/browser/extensions/api/custom_notification_center/custom_notification_center_apitest.cc
|
| diff --git a/chrome/browser/extensions/api/custom_notification_center/custom_notification_center_apitest.cc b/chrome/browser/extensions/api/custom_notification_center/custom_notification_center_apitest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6853e9f0ecfcb639a7ea5a894ed9161dbced76b9
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/custom_notification_center/custom_notification_center_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/custom_notification_center/custom_notification_center_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/custom_notification_center.h"
|
| +
|
| +typedef ExtensionApiTest CustomNotificationCenterApiTest;
|
| +
|
| +IN_PROC_BROWSER_TEST_F(CustomNotificationCenterApiTest, Events) {
|
| + std::string sender_id1 = "SenderId1";
|
| + std::string notification_id1 = "NotificationId1";
|
| + base::DictionaryValue* content_args = new base::DictionaryValue();
|
| + content_args->SetWithoutPathExpansion("type", new base::StringValue("basic"));
|
| + content_args->SetWithoutPathExpansion("inconUrl",
|
| + new base::StringValue("icon.png"));
|
| + content_args->SetWithoutPathExpansion("title",
|
| + new base::StringValue("Title"));
|
| + content_args->SetWithoutPathExpansion(
|
| + "message", new base::StringValue("Here goes the message."));
|
| + extensions::api::custom_notification_center::NotificationContent* content =
|
| + new extensions::api::custom_notification_center::NotificationContent();
|
| + extensions::api::custom_notification_center::NotificationContent::Populate(
|
| + *content_args, content);
|
| +
|
| + ResultCatcher catcher;
|
| + catcher.RestrictToProfile(browser()->profile());
|
| +
|
| + // Test custom notification center extension
|
| + const extensions::Extension* extension = LoadExtension(
|
| + test_data_dir_.AppendASCII("custom_notification_center/events"));
|
| + ASSERT_TRUE(extension);
|
| +
|
| + extensions::CustomNotificationCenterEventRouter* event_router =
|
| + new extensions::CustomNotificationCenterEventRouter(browser()->profile());
|
| +
|
| + event_router->CreateNotification(
|
| + extension->id(), sender_id1, notification_id1, *content);
|
| + event_router->UpdateNotification(
|
| + extension->id(), sender_id1, notification_id1, *content);
|
| + event_router->ClearNotification(
|
| + extension->id(), sender_id1, notification_id1);
|
| +
|
| + EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
|
| +}
|
|
|