OLD | NEW |
---|---|
(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/notification_getter/notification_getter_ 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/notification_getter.h" | |
10 | |
11 typedef ExtensionApiTest NotificationGetterApiTest; | |
12 | |
13 IN_PROC_BROWSER_TEST_F(NotificationGetterApiTest, Events) { | |
14 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.
| |
15 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.
| |
16 options->SetWithoutPathExpansion("type", new base::StringValue("basic")); | |
17 options->SetWithoutPathExpansion("inconUrl", | |
18 new base::StringValue("icon.png")); | |
19 options->SetWithoutPathExpansion("title", new base::StringValue("Title")); | |
20 options->SetWithoutPathExpansion( | |
21 "message", new base::StringValue("Here goes the message.")); | |
22 extensions::api::notification_getter::NotificationOptions* options_ = | |
23 new extensions::api::notification_getter::NotificationOptions(); | |
24 extensions::api::notification_getter::NotificationOptions::Populate(*options, | |
25 options_); | |
26 | |
27 ResultCatcher catcher; | |
28 catcher.RestrictToProfile(browser()->profile()); | |
29 | |
30 const extensions::Extension* extension = | |
31 LoadExtension(test_data_dir_.AppendASCII("notification_getter/events")); | |
32 ASSERT_TRUE(extension); | |
33 | |
34 extensions::NotificationGetterEventRouter* event_router = | |
35 new extensions::NotificationGetterEventRouter(browser()->profile()); | |
36 | |
37 event_router->CreateNotificationForTest( | |
38 extension->id(), sender_id1_, notification_id1_, *options_); | |
39 event_router->UpdateNotificationForTest( | |
40 extension->id(), sender_id1_, notification_id1_, *options_); | |
41 event_router->CloseNotificationForTest( | |
42 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
| |
43 | |
44 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
45 } | |
OLD | NEW |