Chromium Code Reviews| Index: chrome/browser/extensions/api/notification_getter/notification_getter_apitest.cc |
| diff --git a/chrome/browser/extensions/api/notification_getter/notification_getter_apitest.cc b/chrome/browser/extensions/api/notification_getter/notification_getter_apitest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fbcd42eb7a19ecc0d2405ecea03fbdab712bc384 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/notification_getter/notification_getter_apitest.cc |
| @@ -0,0 +1,45 @@ |
| +// 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_getter/notification_getter_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_getter.h" |
| + |
| +typedef ExtensionApiTest NotificationGetterApiTest; |
| + |
| +IN_PROC_BROWSER_TEST_F(NotificationGetterApiTest, Events) { |
| + std::string sender_id1_ = "SenderId1", notification_id1_ = "NotificationId1"; |
|
Pete Williamson
2014/06/30 19:03:49
Let's use two separate lines for this, it makes co
liyanhou
2014/07/14 17:44:44
Done.
|
| + base::DictionaryValue* options = new base::DictionaryValue(); |
|
Pete Williamson
2014/06/30 19:03:49
We have options (declared here) and options_ (decl
liyanhou
2014/07/14 17:44:44
Done.
|
| + options->SetWithoutPathExpansion("type", new base::StringValue("basic")); |
| + options->SetWithoutPathExpansion("inconUrl", |
| + new base::StringValue("icon.png")); |
| + options->SetWithoutPathExpansion("title", new base::StringValue("Title")); |
| + options->SetWithoutPathExpansion( |
| + "message", new base::StringValue("Here goes the message.")); |
| + extensions::api::notification_getter::NotificationOptions* options_ = |
| + new extensions::api::notification_getter::NotificationOptions(); |
| + extensions::api::notification_getter::NotificationOptions::Populate(*options, |
| + options_); |
| + |
| + ResultCatcher catcher; |
| + catcher.RestrictToProfile(browser()->profile()); |
| + |
| + const extensions::Extension* extension = |
| + LoadExtension(test_data_dir_.AppendASCII("notification_getter/events")); |
| + ASSERT_TRUE(extension); |
| + |
| + extensions::NotificationGetterEventRouter* event_router = |
| + new extensions::NotificationGetterEventRouter(browser()->profile()); |
| + |
| + event_router->CreateNotificationForTest( |
| + extension->id(), sender_id1_, notification_id1_, *options_); |
| + event_router->UpdateNotificationForTest( |
| + extension->id(), sender_id1_, notification_id1_, *options_); |
| + event_router->CloseNotificationForTest( |
| + extension->id(), sender_id1_, notification_id1_); |
|
Pete Williamson
2014/06/30 19:03:49
You are calling three functions in this one test.
liyanhou
2014/07/14 17:44:44
I just tried it. Yes, if any of them fails, the wh
|
| + |
| + EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| +} |