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

Side by Side Diff: chrome/browser/notifications/notification_browsertest.cc

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 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 | Annotate | Revision Log
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 <deque> 5 #include <deque>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 18 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
19 #include "chrome/browser/infobars/infobar.h"
20 #include "chrome/browser/infobars/infobar_service.h" 19 #include "chrome/browser/infobars/infobar_service.h"
21 #include "chrome/browser/notifications/desktop_notification_service.h" 20 #include "chrome/browser/notifications/desktop_notification_service.h"
22 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 21 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
23 #include "chrome/browser/notifications/notification.h" 22 #include "chrome/browser/notifications/notification.h"
24 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_tabstrip.h" 25 #include "chrome/browser/ui/browser_tabstrip.h"
27 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/common/content_settings.h" 28 #include "chrome/common/content_settings.h"
30 #include "chrome/common/content_settings_pattern.h" 29 #include "chrome/common/content_settings_pattern.h"
31 #include "chrome/test/base/in_process_browser_test.h" 30 #include "chrome/test/base/in_process_browser_test.h"
32 #include "chrome/test/base/ui_test_utils.h" 31 #include "chrome/test/base/ui_test_utils.h"
32 #include "components/infobars/core/infobar.h"
33 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/notification_types.h" 35 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/render_view_host.h" 36 #include "content/public/browser/render_view_host.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "content/public/test/browser_test_utils.h" 38 #include "content/public/test/browser_test_utils.h"
39 #include "content/public/test/test_utils.h" 39 #include "content/public/test/test_utils.h"
40 #include "net/base/net_util.h" 40 #include "net/base/net_util.h"
41 #include "net/test/embedded_test_server/embedded_test_server.h" 41 #include "net/test/embedded_test_server/embedded_test_server.h"
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 InfobarAction action, 283 InfobarAction action,
284 size_t infobar_index, 284 size_t infobar_index,
285 int tab_index) { 285 int tab_index) {
286 InfoBarService* infobar_service = InfoBarService::FromWebContents( 286 InfoBarService* infobar_service = InfoBarService::FromWebContents(
287 browser->tab_strip_model()->GetWebContentsAt(tab_index)); 287 browser->tab_strip_model()->GetWebContentsAt(tab_index));
288 if (infobar_index >= infobar_service->infobar_count()) { 288 if (infobar_index >= infobar_service->infobar_count()) {
289 ADD_FAILURE(); 289 ADD_FAILURE();
290 return false; 290 return false;
291 } 291 }
292 292
293 InfoBar* infobar = infobar_service->infobar_at(infobar_index); 293 infobars::InfoBar* infobar = infobar_service->infobar_at(infobar_index);
294 InfoBarDelegate* infobar_delegate = infobar->delegate(); 294 infobars::InfoBarDelegate* infobar_delegate = infobar->delegate();
295 switch (action) { 295 switch (action) {
296 case DISMISS: 296 case DISMISS:
297 infobar_delegate->InfoBarDismissed(); 297 infobar_delegate->InfoBarDismissed();
298 infobar_service->RemoveInfoBar(infobar); 298 infobar_service->RemoveInfoBar(infobar);
299 return true; 299 return true;
300 300
301 case ALLOW: { 301 case ALLOW: {
302 ConfirmInfoBarDelegate* confirm_infobar_delegate = 302 ConfirmInfoBarDelegate* confirm_infobar_delegate =
303 infobar_delegate->AsConfirmInfoBarDelegate(); 303 infobar_delegate->AsConfirmInfoBarDelegate();
304 if (!confirm_infobar_delegate) { 304 if (!confirm_infobar_delegate) {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 browser(), false, "no_such_file.png", "Title2", "Body2", "chat"); 782 browser(), false, "no_such_file.png", "Title2", "Body2", "chat");
783 EXPECT_NE("-1", result); 783 EXPECT_NE("-1", result);
784 784
785 ASSERT_EQ(1, GetNotificationCount()); 785 ASSERT_EQ(1, GetNotificationCount());
786 message_center::NotificationList::Notifications notifications = 786 message_center::NotificationList::Notifications notifications =
787 message_center::MessageCenter::Get()->GetVisibleNotifications(); 787 message_center::MessageCenter::Get()->GetVisibleNotifications();
788 EXPECT_EQ(base::ASCIIToUTF16("Title2"), (*notifications.rbegin())->title()); 788 EXPECT_EQ(base::ASCIIToUTF16("Title2"), (*notifications.rbegin())->title());
789 EXPECT_EQ(base::ASCIIToUTF16("Body2"), 789 EXPECT_EQ(base::ASCIIToUTF16("Body2"),
790 (*notifications.rbegin())->message()); 790 (*notifications.rbegin())->message());
791 } 791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698