| OLD | NEW |
| 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 #include "chrome/browser/extensions/chrome_extension_function.h" | 6 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/extensions/api/notification_provider.h" | 9 #include "chrome/common/extensions/api/notification_provider.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 extension->id(), sender_id1, notification_id1, *options); | 47 extension->id(), sender_id1, notification_id1, *options); |
| 48 event_router->UpdateNotification( | 48 event_router->UpdateNotification( |
| 49 extension->id(), sender_id1, notification_id1, *options); | 49 extension->id(), sender_id1, notification_id1, *options); |
| 50 event_router->ClearNotification( | 50 event_router->ClearNotification( |
| 51 extension->id(), sender_id1, notification_id1); | 51 extension->id(), sender_id1, notification_id1); |
| 52 | 52 |
| 53 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 53 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, TestBasicUsage) { | 56 IN_PROC_BROWSER_TEST_F(NotificationProviderApiTest, TestBasicUsage) { |
| 57 // set up content of a notification | 57 ASSERT_TRUE(RunExtensionTest("notification_provider/basic_usage")) |
| 58 std::string sender_id1 = "SenderId"; | 58 << message_; |
| 59 std::string notification_id1 = "NotificationId"; | |
| 60 | |
| 61 scoped_ptr<extensions::api::notifications::NotificationOptions> options( | |
| 62 new extensions::api::notifications::NotificationOptions()); | |
| 63 CreateNotificationOptionsForTest(options.get()); | |
| 64 | |
| 65 ResultCatcher catcher; | |
| 66 catcher.RestrictToProfile(browser()->profile()); | |
| 67 | |
| 68 // Test notification provider extension | |
| 69 const extensions::Extension* extension = LoadExtension( | |
| 70 test_data_dir_.AppendASCII("notification_provider/basic_usage")); | |
| 71 ASSERT_TRUE(extension); | |
| 72 | |
| 73 scoped_ptr<extensions::NotificationProviderEventRouter> event_router( | |
| 74 new extensions::NotificationProviderEventRouter(browser()->profile())); | |
| 75 | |
| 76 event_router->CreateNotification( | |
| 77 extension->id(), sender_id1, notification_id1, *options); | |
| 78 | |
| 79 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 80 } | 59 } |
| OLD | NEW |