| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 5 |
| 6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void SendOpenedNotification() { | 61 void SendOpenedNotification() { |
| 62 string16 frame_name = ASCIIToUTF16("background"); | 62 string16 frame_name = ASCIIToUTF16("background"); |
| 63 BackgroundContentsOpenedDetails details = { | 63 BackgroundContentsOpenedDetails details = { |
| 64 this, frame_name, appid_ }; | 64 this, frame_name, appid_ }; |
| 65 NotificationService::current()->Notify( | 65 NotificationService::current()->Notify( |
| 66 NotificationType::BACKGROUND_CONTENTS_OPENED, | 66 NotificationType::BACKGROUND_CONTENTS_OPENED, |
| 67 Source<Profile>(profile_), | 67 Source<Profile>(profile_), |
| 68 Details<BackgroundContentsOpenedDetails>(&details)); | 68 Details<BackgroundContentsOpenedDetails>(&details)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual const void Navigate(GURL url) { | 71 virtual void Navigate(GURL url) { |
| 72 url_ = url; | 72 url_ = url; |
| 73 NotificationService::current()->Notify( | 73 NotificationService::current()->Notify( |
| 74 NotificationType::BACKGROUND_CONTENTS_NAVIGATED, | 74 NotificationType::BACKGROUND_CONTENTS_NAVIGATED, |
| 75 Source<Profile>(profile_), | 75 Source<Profile>(profile_), |
| 76 Details<BackgroundContents>(this)); | 76 Details<BackgroundContents>(this)); |
| 77 } | 77 } |
| 78 virtual const GURL& GetURL() const { return url_; } | 78 virtual const GURL& GetURL() const { return url_; } |
| 79 | 79 |
| 80 void MockClose(Profile* profile) { | 80 void MockClose(Profile* profile) { |
| 81 NotificationService::current()->Notify( | 81 NotificationService::current()->Notify( |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 contents->Navigate(url); | 224 contents->Navigate(url); |
| 225 EXPECT_EQ(1U, GetPrefs(&profile)->size()); | 225 EXPECT_EQ(1U, GetPrefs(&profile)->size()); |
| 226 contents2->Navigate(url2); | 226 contents2->Navigate(url2); |
| 227 EXPECT_EQ(2U, GetPrefs(&profile)->size()); | 227 EXPECT_EQ(2U, GetPrefs(&profile)->size()); |
| 228 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid")); | 228 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid")); |
| 229 EXPECT_FALSE(service.IsTracked(contents)); | 229 EXPECT_FALSE(service.IsTracked(contents)); |
| 230 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid"))); | 230 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid"))); |
| 231 EXPECT_EQ(1U, GetPrefs(&profile)->size()); | 231 EXPECT_EQ(1U, GetPrefs(&profile)->size()); |
| 232 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid())); | 232 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid())); |
| 233 } | 233 } |
| OLD | NEW |