summaryrefslogtreecommitdiffstats
path: root/chrome/browser/background_contents_service_unittest.cc
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 19:31:12 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 19:31:12 +0000
commitda58f5b14586b6db155a22b8b1c8d4de8cf6d8f5 (patch)
treebbdc8f01e3a24d791abc41ce5404e3202e803def /chrome/browser/background_contents_service_unittest.cc
parent4f35e4b08dbd1ed5221402a5aba29a69ef27fa58 (diff)
downloadchromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.zip
chromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.tar.gz
chromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.tar.bz2
Added support for displaying BackgroundContents in the task manager.
Previously BackgroundContents would get created, but since they were not TabContents, they would not show up. BUG=62105 TEST=TaskManagerBrowserTest.NoticeBGContentsChanges Review URL: http://codereview.chromium.org/4760001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_contents_service_unittest.cc')
-rw-r--r--chrome/browser/background_contents_service_unittest.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/chrome/browser/background_contents_service_unittest.cc b/chrome/browser/background_contents_service_unittest.cc
index 23ba929..566b74b 100644
--- a/chrome/browser/background_contents_service_unittest.cc
+++ b/chrome/browser/background_contents_service_unittest.cc
@@ -57,14 +57,11 @@ class MockBackgroundContents : public BackgroundContents {
profile_(profile) {
}
- void SendOpenedNotification() {
+ void SendOpenedNotification(BackgroundContentsService* service) {
string16 frame_name = ASCIIToUTF16("background");
BackgroundContentsOpenedDetails details = {
this, frame_name, appid_ };
- NotificationService::current()->Notify(
- NotificationType::BACKGROUND_CONTENTS_OPENED,
- Source<Profile>(profile_),
- Details<BackgroundContentsOpenedDetails>(&details));
+ service->BackgroundContentsOpened(&details);
}
virtual void Navigate(GURL url) {
@@ -114,7 +111,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsCreateDestroy) {
BackgroundContentsService service(&profile, command_line_.get());
MockBackgroundContents* contents = new MockBackgroundContents(&profile);
EXPECT_FALSE(service.IsTracked(contents));
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
EXPECT_TRUE(service.IsTracked(contents));
delete contents;
EXPECT_FALSE(service.IsTracked(contents));
@@ -131,7 +128,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAdded) {
scoped_ptr<MockBackgroundContents> contents(
new MockBackgroundContents(&profile));
EXPECT_EQ(0U, GetPrefs(&profile)->size());
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
contents->Navigate(url);
EXPECT_EQ(1U, GetPrefs(&profile)->size());
@@ -154,7 +151,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAddedAndClosed) {
GURL url("http://a/");
MockBackgroundContents* contents = new MockBackgroundContents(&profile);
EXPECT_EQ(0U, GetPrefs(&profile)->size());
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
contents->Navigate(url);
EXPECT_EQ(1U, GetPrefs(&profile)->size());
EXPECT_EQ(url.spec(), GetPrefURLForApp(&profile, contents->appid()));
@@ -174,7 +171,7 @@ TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) {
{
scoped_ptr<MockBackgroundContents> contents(new MockBackgroundContents(
&profile, "appid"));
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
contents->Navigate(url);
EXPECT_EQ(1U, GetPrefs(&profile)->size());
EXPECT_EQ(url.spec(), GetPrefURLForApp(&profile, contents->appid()));
@@ -187,7 +184,7 @@ TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) {
// URL again.
scoped_ptr<MockBackgroundContents> contents(new MockBackgroundContents(
&profile, "appid"));
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
contents->Navigate(url);
EXPECT_EQ(1U, GetPrefs(&profile)->size());
}
@@ -206,9 +203,9 @@ TEST_F(BackgroundContentsServiceTest, TestApplicationIDLinkage) {
"appid");
scoped_ptr<MockBackgroundContents> contents2(
new MockBackgroundContents(&profile, "appid2"));
- contents->SendOpenedNotification();
+ contents->SendOpenedNotification(&service);
EXPECT_EQ(contents, service.GetAppBackgroundContents(contents->appid()));
- contents2->SendOpenedNotification();
+ contents2->SendOpenedNotification(&service);
EXPECT_EQ(contents2.get(), service.GetAppBackgroundContents(
contents2->appid()));
EXPECT_EQ(0U, GetPrefs(&profile)->size());