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/test/base/testing_browser_process.h" | 7 #include "chrome/test/base/testing_browser_process.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 #include "chrome/test/base/testing_profile_manager.h" | 9 #include "chrome/test/base/testing_profile_manager.h" |
10 #include "components/drive/dummy_file_system.h" | 10 #include "components/drive/dummy_file_system.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 protected: | 29 protected: |
30 content::TestBrowserThreadBundle thread_bundle_; | 30 content::TestBrowserThreadBundle thread_bundle_; |
31 // DriveIntegrationService depends on DriveNotificationManager which depends | 31 // DriveIntegrationService depends on DriveNotificationManager which depends |
32 // on InvalidationService. On Chrome OS, the InvalidationServiceFactory | 32 // on InvalidationService. On Chrome OS, the InvalidationServiceFactory |
33 // uses chromeos::ProfileHelper, which needs the ProfileManager or a | 33 // uses chromeos::ProfileHelper, which needs the ProfileManager or a |
34 // TestProfileManager to be running. | 34 // TestProfileManager to be running. |
35 TestingProfileManager profile_manager_; | 35 TestingProfileManager profile_manager_; |
36 }; | 36 }; |
37 | 37 |
38 TEST_F(DriveIntegrationServiceTest, InitializeAndShutdown) { | 38 TEST_F(DriveIntegrationServiceTest, InitializeAndShutdown) { |
39 scoped_ptr<DriveIntegrationService> integration_service( | 39 std::unique_ptr<DriveIntegrationService> integration_service( |
40 new DriveIntegrationService( | 40 new DriveIntegrationService( |
41 profile_manager_.CreateTestingProfile(kTestProfileName), | 41 profile_manager_.CreateTestingProfile(kTestProfileName), NULL, |
42 NULL, | 42 new DummyDriveService, std::string(), base::FilePath(), |
43 new DummyDriveService, | |
44 std::string(), | |
45 base::FilePath(), | |
46 new DummyFileSystem)); | 43 new DummyFileSystem)); |
47 integration_service->SetEnabled(true); | 44 integration_service->SetEnabled(true); |
48 content::RunAllBlockingPoolTasksUntilIdle(); | 45 content::RunAllBlockingPoolTasksUntilIdle(); |
49 integration_service->Shutdown(); | 46 integration_service->Shutdown(); |
50 } | 47 } |
51 | 48 |
52 TEST_F(DriveIntegrationServiceTest, ServiceInstanceIdentity) { | 49 TEST_F(DriveIntegrationServiceTest, ServiceInstanceIdentity) { |
53 TestingProfile* user1 = profile_manager_.CreateTestingProfile("user1"); | 50 TestingProfile* user1 = profile_manager_.CreateTestingProfile("user1"); |
54 | 51 |
55 // Integration Service is created as a profile keyed service. | 52 // Integration Service is created as a profile keyed service. |
56 EXPECT_TRUE(DriveIntegrationServiceFactory::GetForProfile(user1)); | 53 EXPECT_TRUE(DriveIntegrationServiceFactory::GetForProfile(user1)); |
57 | 54 |
58 // Shares the same instance with the incognito mode profile. | 55 // Shares the same instance with the incognito mode profile. |
59 Profile* user1_incognito = user1->GetOffTheRecordProfile(); | 56 Profile* user1_incognito = user1->GetOffTheRecordProfile(); |
60 EXPECT_EQ(DriveIntegrationServiceFactory::GetForProfile(user1), | 57 EXPECT_EQ(DriveIntegrationServiceFactory::GetForProfile(user1), |
61 DriveIntegrationServiceFactory::GetForProfile(user1_incognito)); | 58 DriveIntegrationServiceFactory::GetForProfile(user1_incognito)); |
62 | 59 |
63 // For different profiles, different services are running. | 60 // For different profiles, different services are running. |
64 TestingProfile* user2 = profile_manager_.CreateTestingProfile("user2"); | 61 TestingProfile* user2 = profile_manager_.CreateTestingProfile("user2"); |
65 EXPECT_NE(DriveIntegrationServiceFactory::GetForProfile(user1), | 62 EXPECT_NE(DriveIntegrationServiceFactory::GetForProfile(user1), |
66 DriveIntegrationServiceFactory::GetForProfile(user2)); | 63 DriveIntegrationServiceFactory::GetForProfile(user2)); |
67 } | 64 } |
68 | 65 |
69 } // namespace drive | 66 } // namespace drive |
OLD | NEW |