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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_apitest.cc

Issue 569493003: Remove CreateEmptyExtension from extension_function_test_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/strings/string_number_conversions.h" 5 #include "base/strings/string_number_conversions.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_function_test_utils.h" 11 #include "chrome/browser/extensions/extension_function_test_utils.h"
12 #include "chrome/browser/notifications/notification.h" 12 #include "chrome/browser/notifications/notification.h"
13 #include "chrome/browser/notifications/notification_ui_manager.h" 13 #include "chrome/browser/notifications/notification_ui_manager.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
16 #include "extensions/browser/api/test/test_api.h" 16 #include "extensions/browser/api/test/test_api.h"
17 #include "extensions/browser/notification_types.h" 17 #include "extensions/browser/notification_types.h"
18 #include "extensions/common/features/feature.h" 18 #include "extensions/common/features/feature.h"
19 #include "extensions/common/test_util.h"
19 #include "extensions/test/result_catcher.h" 20 #include "extensions/test/result_catcher.h"
20 #include "ui/message_center/message_center.h" 21 #include "ui/message_center/message_center.h"
21 #include "ui/message_center/notification_list.h" 22 #include "ui/message_center/notification_list.h"
22 #include "ui/message_center/notifier_settings.h" 23 #include "ui/message_center/notifier_settings.h"
23 24
24 using extensions::Extension; 25 using extensions::Extension;
25 using extensions::ResultCatcher; 26 using extensions::ResultCatcher;
26 27
27 namespace utils = extension_function_test_utils; 28 namespace utils = extension_function_test_utils;
28 29
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 message_center::Notification* notification = *(notifications.begin()); 158 message_center::Notification* notification = *(notifications.begin());
158 LOG(INFO) << "Notification ID: " << notification->id(); 159 LOG(INFO) << "Notification ID: " << notification->id();
159 160
160 EXPECT_EQ(base::ASCIIToUTF16(kNewTitle), notification->title()); 161 EXPECT_EQ(base::ASCIIToUTF16(kNewTitle), notification->title());
161 EXPECT_EQ(base::ASCIIToUTF16(kNewMessage), notification->message()); 162 EXPECT_EQ(base::ASCIIToUTF16(kNewMessage), notification->message());
162 EXPECT_EQ(kNewPriority, notification->priority()); 163 EXPECT_EQ(kNewPriority, notification->priority());
163 EXPECT_EQ(0u, notification->buttons().size()); 164 EXPECT_EQ(0u, notification->buttons().size());
164 } 165 }
165 166
166 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestGetPermissionLevel) { 167 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestGetPermissionLevel) {
167 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); 168 scoped_refptr<Extension> empty_extension(
169 extensions::test_util::CreateEmptyExtension());
168 170
169 // Get permission level for the extension whose notifications are enabled. 171 // Get permission level for the extension whose notifications are enabled.
170 { 172 {
171 scoped_refptr<extensions::NotificationsGetPermissionLevelFunction> 173 scoped_refptr<extensions::NotificationsGetPermissionLevelFunction>
172 notification_function( 174 notification_function(
173 new extensions::NotificationsGetPermissionLevelFunction()); 175 new extensions::NotificationsGetPermissionLevelFunction());
174 176
175 notification_function->set_extension(empty_extension.get()); 177 notification_function->set_extension(empty_extension.get());
176 notification_function->set_has_callback(true); 178 notification_function->set_has_callback(true);
177 179
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 notification->ButtonClick(0); 267 notification->ButtonClick(0);
266 EXPECT_TRUE(catcher.GetNextResult()); 268 EXPECT_TRUE(catcher.GetNextResult());
267 notification->Click(); 269 notification->Click();
268 EXPECT_TRUE(catcher.GetNextResult()); 270 EXPECT_TRUE(catcher.GetNextResult());
269 notification->Close(true); 271 notification->Close(true);
270 EXPECT_TRUE(catcher.GetNextResult()); 272 EXPECT_TRUE(catcher.GetNextResult());
271 notification->Close(false); 273 notification->Close(false);
272 EXPECT_FALSE(catcher.GetNextResult()); 274 EXPECT_FALSE(catcher.GetNextResult());
273 } 275 }
274 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698