| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/drive/drive_integration_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/dummy_file_system.h" | 7 #include "chrome/browser/chromeos/drive/dummy_file_system.h" |
| 8 #include "chrome/browser/chromeos/drive/test_util.h" | 8 #include "chrome/browser/chromeos/drive/test_util.h" |
| 9 #include "chrome/browser/drive/dummy_drive_service.h" | 9 #include "chrome/browser/drive/dummy_drive_service.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "chrome/test/base/testing_profile_manager.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace drive { | 16 namespace drive { |
| 15 | 17 |
| 18 namespace{ |
| 19 const char kTestProfileName[] = "test-profile"; |
| 20 } |
| 21 |
| 16 class DriveIntegrationServiceTest : public testing::Test { | 22 class DriveIntegrationServiceTest : public testing::Test { |
| 17 public: | 23 public: |
| 24 DriveIntegrationServiceTest() |
| 25 : profile_manager_(TestingBrowserProcess::GetGlobal()) {} |
| 26 |
| 18 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() OVERRIDE { |
| 19 profile_.reset(new TestingProfile); | 28 ASSERT_TRUE(profile_manager_.SetUp()); |
| 20 integration_service_.reset(new DriveIntegrationService( | 29 integration_service_.reset(new DriveIntegrationService( |
| 21 profile_.get(), NULL, new DummyDriveService, std::string(), | 30 profile_manager_.CreateTestingProfile(kTestProfileName), |
| 22 base::FilePath(), new DummyFileSystem)); | 31 NULL, |
| 32 new DummyDriveService, |
| 33 std::string(), |
| 34 base::FilePath(), |
| 35 new DummyFileSystem)); |
| 23 } | 36 } |
| 24 | 37 |
| 25 protected: | 38 protected: |
| 26 content::TestBrowserThreadBundle thread_bundle_; | 39 content::TestBrowserThreadBundle thread_bundle_; |
| 27 scoped_ptr<TestingProfile> profile_; | 40 // DriveIntegrationService depends on DriveNotificationManager which depends |
| 41 // on InvalidationService. On Chrome OS, the InvalidationServiceFactory |
| 42 // uses chromeos::ProfileHelper, which needs the ProfileManager or a |
| 43 // TestProfileManager to be running. |
| 44 TestingProfileManager profile_manager_; |
| 28 scoped_ptr<DriveIntegrationService> integration_service_; | 45 scoped_ptr<DriveIntegrationService> integration_service_; |
| 29 }; | 46 }; |
| 30 | 47 |
| 31 TEST_F(DriveIntegrationServiceTest, InitializeAndShutdown) { | 48 TEST_F(DriveIntegrationServiceTest, InitializeAndShutdown) { |
| 32 integration_service_->SetEnabled(true); | 49 integration_service_->SetEnabled(true); |
| 33 test_util::RunBlockingPoolTask(); | 50 test_util::RunBlockingPoolTask(); |
| 34 integration_service_->Shutdown(); | 51 integration_service_->Shutdown(); |
| 35 } | 52 } |
| 36 | 53 |
| 37 } // namespace drive | 54 } // namespace drive |
| OLD | NEW |