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