Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: chrome/browser/chromeos/drive/drive_integration_service_unittest.cc

Issue 323293003: Add test for the identity of incognito mode DriveIntegrationService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_integration_service_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_integration_service_unittest.cc b/chrome/browser/chromeos/drive/drive_integration_service_unittest.cc
index dc37a109f584addc6559e38a41aa4de8df8a0af8..07b6d0bda2d23e0d21073bd1bafbb4a061c32a72 100644
--- a/chrome/browser/chromeos/drive/drive_integration_service_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_integration_service_unittest.cc
@@ -26,13 +26,6 @@ class DriveIntegrationServiceTest : public testing::Test {
virtual void SetUp() OVERRIDE {
ASSERT_TRUE(profile_manager_.SetUp());
- integration_service_.reset(new DriveIntegrationService(
- profile_manager_.CreateTestingProfile(kTestProfileName),
- NULL,
- new DummyDriveService,
- std::string(),
- base::FilePath(),
- new DummyFileSystem));
}
protected:
@@ -42,13 +35,37 @@ class DriveIntegrationServiceTest : public testing::Test {
// uses chromeos::ProfileHelper, which needs the ProfileManager or a
// TestProfileManager to be running.
TestingProfileManager profile_manager_;
- scoped_ptr<DriveIntegrationService> integration_service_;
};
TEST_F(DriveIntegrationServiceTest, InitializeAndShutdown) {
- integration_service_->SetEnabled(true);
+ scoped_ptr<DriveIntegrationService> integration_service(
+ new DriveIntegrationService(
+ profile_manager_.CreateTestingProfile(kTestProfileName),
+ NULL,
+ new DummyDriveService,
+ std::string(),
+ base::FilePath(),
+ new DummyFileSystem));
+ integration_service->SetEnabled(true);
test_util::RunBlockingPoolTask();
- integration_service_->Shutdown();
+ integration_service->Shutdown();
+}
+
+TEST_F(DriveIntegrationServiceTest, ServiceInstanceIdentity) {
+ TestingProfile* user1 = profile_manager_.CreateTestingProfile("user1");
+
+ // Integration Service is created as a profile keyed service.
+ EXPECT_TRUE(DriveIntegrationServiceFactory::GetForProfile(user1));
+
+ // Shares the same instance with the incognito mode profile.
+ Profile* user1_incognito = user1->GetOffTheRecordProfile();
+ EXPECT_EQ(DriveIntegrationServiceFactory::GetForProfile(user1),
+ DriveIntegrationServiceFactory::GetForProfile(user1_incognito));
+
+ // For different profiles, different services are running.
+ TestingProfile* user2 = profile_manager_.CreateTestingProfile("user2");
+ EXPECT_NE(DriveIntegrationServiceFactory::GetForProfile(user1),
+ DriveIntegrationServiceFactory::GetForProfile(user2));
}
} // namespace drive
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698