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

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context_unittest.cc

Issue 7006010: Change InfoBar-related notifications to be sourced from a TabContentsWrapper, not a TabContents. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_vector.h" 5 #include "base/memory/scoped_vector.h"
6 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 6 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
7 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 7 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
8 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 8 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
10 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 InfoBarDelegate* removed_infobar_delegate_; 44 InfoBarDelegate* removed_infobar_delegate_;
45 NotificationRegistrar registrar_; 45 NotificationRegistrar registrar_;
46 }; 46 };
47 47
48 TestTabContentsWithPendingInfoBar::TestTabContentsWithPendingInfoBar( 48 TestTabContentsWithPendingInfoBar::TestTabContentsWithPendingInfoBar(
49 Profile* profile, 49 Profile* profile,
50 SiteInstance* instance) 50 SiteInstance* instance)
51 : TabContentsWrapper( 51 : TabContentsWrapper(
52 new TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL)), 52 new TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL)),
53 removed_infobar_delegate_(NULL) { 53 removed_infobar_delegate_(NULL) {
54 Source<TabContents> source(tab_contents()); 54 Source<TabContentsWrapper> source(this);
55 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, 55 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
56 source); 56 source);
57 } 57 }
58 58
59 TestTabContentsWithPendingInfoBar::~TestTabContentsWithPendingInfoBar() { 59 TestTabContentsWithPendingInfoBar::~TestTabContentsWithPendingInfoBar() {
60 } 60 }
61 61
62 void TestTabContentsWithPendingInfoBar::Observe( 62 void TestTabContentsWithPendingInfoBar::Observe(
63 NotificationType type, 63 NotificationType type,
64 const NotificationSource& source, 64 const NotificationSource& source,
65 const NotificationDetails& details) { 65 const NotificationDetails& details) {
66 if (type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) 66 if (type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) {
67 removed_infobar_delegate_ = Details<InfoBarDelegate>(details).ptr(); 67 removed_infobar_delegate_ =
68 else 68 Details<std::pair<InfoBarDelegate*, bool> >(details)->first;
69 } else {
69 TabContentsWrapper::Observe(type, source, details); 70 TabContentsWrapper::Observe(type, source, details);
71 }
70 } 72 }
71 73
72 } // namespace 74 } // namespace
73 75
74 76
75 // GeolocationPermissionContextTests ------------------------------------------ 77 // GeolocationPermissionContextTests ------------------------------------------
76 78
77 // This class sets up GeolocationArbitrator. 79 // This class sets up GeolocationArbitrator.
78 class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { 80 class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness {
79 public: 81 public:
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // Ensure only one infobar is created. 460 // Ensure only one infobar is created.
459 EXPECT_EQ(1U, contents_wrapper()->infobar_count()); 461 EXPECT_EQ(1U, contents_wrapper()->infobar_count());
460 ConfirmInfoBarDelegate* infobar_0 = 462 ConfirmInfoBarDelegate* infobar_0 =
461 contents_wrapper()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); 463 contents_wrapper()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
462 ASSERT_TRUE(infobar_0); 464 ASSERT_TRUE(infobar_0);
463 string16 text_0 = infobar_0->GetMessageText(); 465 string16 text_0 = infobar_0->GetMessageText();
464 466
465 // Delete the tab contents. 467 // Delete the tab contents.
466 DeleteContents(); 468 DeleteContents();
467 } 469 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_browsertest.cc ('k') | chrome/browser/tab_contents/infobar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698