| Index: chrome/browser/background/background_contents_service_unittest.cc
|
| diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc
|
| index a58cfbc3ad1e2514fadd84d5553a371e7e7129ff..2b8289750cbeff3dfa449a65cb4ef3664b78345a 100644
|
| --- a/chrome/browser/background/background_contents_service_unittest.cc
|
| +++ b/chrome/browser/background/background_contents_service_unittest.cc
|
| @@ -19,18 +19,25 @@
|
| #include "chrome/test/base/testing_browser_process.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "content/public/browser/notification_service.h"
|
| +#include "content/public/test/test_browser_thread_bundle.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "testing/platform_test.h"
|
| +#include "ui/message_center/message_center.h"
|
| #include "url/gurl.h"
|
|
|
| class BackgroundContentsServiceTest : public testing::Test {
|
| public:
|
| - BackgroundContentsServiceTest() {}
|
| - virtual ~BackgroundContentsServiceTest() {}
|
| virtual void SetUp() {
|
| command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
|
| }
|
|
|
| + static void SetUpTestCase() {
|
| + message_center::MessageCenter::Initialize();
|
| + }
|
| + static void TearDownTestCase() {
|
| + message_center::MessageCenter::Shutdown();
|
| + }
|
| +
|
| const DictionaryValue* GetPrefs(Profile* profile) {
|
| return profile->GetPrefs()->GetDictionary(
|
| prefs::kRegisteredBackgroundContents);
|
| @@ -106,11 +113,13 @@ class MockBackgroundContents : public BackgroundContents {
|
|
|
| TEST_F(BackgroundContentsServiceTest, Create) {
|
| // Check for creation and leaks.
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| }
|
|
|
| TEST_F(BackgroundContentsServiceTest, BackgroundContentsCreateDestroy) {
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| MockBackgroundContents* contents = new MockBackgroundContents(&profile);
|
| @@ -122,6 +131,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsCreateDestroy) {
|
| }
|
|
|
| TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAdded) {
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| BackgroundContentsServiceFactory::GetInstance()->
|
| @@ -149,6 +159,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAdded) {
|
| }
|
|
|
| TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAddedAndClosed) {
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| BackgroundContentsServiceFactory::GetInstance()->
|
| @@ -170,6 +181,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAddedAndClosed) {
|
| // Test what happens if a BackgroundContents shuts down (say, due to a renderer
|
| // crash) then is restarted. Should not persist URL twice.
|
| TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) {
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| BackgroundContentsServiceFactory::GetInstance()->
|
| @@ -202,6 +214,7 @@ TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) {
|
| // between a BackgroundContents and its parent extension, including
|
| // unregistering the BC when the extension is uninstalled.
|
| TEST_F(BackgroundContentsServiceTest, TestApplicationIDLinkage) {
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| TestingProfile profile;
|
| BackgroundContentsService service(&profile, command_line_.get());
|
| BackgroundContentsServiceFactory::GetInstance()->
|
|
|