| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/background_contents_service.h" | 11 #include "chrome/browser/background_contents_service.h" |
| 12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/tab_contents/background_contents.h" | 14 #include "chrome/browser/tab_contents/background_contents.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/testing_browser_process.h" | 16 #include "chrome/test/testing_browser_process.h" |
| 17 #include "chrome/test/testing_browser_process_test.h" |
| 17 #include "chrome/test/testing_profile.h" | 18 #include "chrome/test/testing_profile.h" |
| 18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
| 21 | 22 |
| 22 class BackgroundContentsServiceTest : public testing::Test { | 23 class BackgroundContentsServiceTest : public TestingBrowserProcessTest { |
| 23 public: | 24 public: |
| 24 BackgroundContentsServiceTest() {} | 25 BackgroundContentsServiceTest() {} |
| 25 ~BackgroundContentsServiceTest() {} | 26 ~BackgroundContentsServiceTest() {} |
| 26 void SetUp() { | 27 void SetUp() { |
| 27 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 28 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 28 } | 29 } |
| 29 | 30 |
| 30 DictionaryValue* GetPrefs(Profile* profile) { | 31 DictionaryValue* GetPrefs(Profile* profile) { |
| 31 return profile->GetPrefs()->GetMutableDictionary( | 32 return profile->GetPrefs()->GetMutableDictionary( |
| 32 prefs::kRegisteredBackgroundContents); | 33 prefs::kRegisteredBackgroundContents); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 contents->Navigate(url); | 217 contents->Navigate(url); |
| 217 EXPECT_EQ(1U, GetPrefs(&profile)->size()); | 218 EXPECT_EQ(1U, GetPrefs(&profile)->size()); |
| 218 contents2->Navigate(url2); | 219 contents2->Navigate(url2); |
| 219 EXPECT_EQ(2U, GetPrefs(&profile)->size()); | 220 EXPECT_EQ(2U, GetPrefs(&profile)->size()); |
| 220 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid")); | 221 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid")); |
| 221 EXPECT_FALSE(service.IsTracked(contents)); | 222 EXPECT_FALSE(service.IsTracked(contents)); |
| 222 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid"))); | 223 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid"))); |
| 223 EXPECT_EQ(1U, GetPrefs(&profile)->size()); | 224 EXPECT_EQ(1U, GetPrefs(&profile)->size()); |
| 224 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid())); | 225 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid())); |
| 225 } | 226 } |
| OLD | NEW |