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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/guid.h" | 13 #include "base/guid.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/invalidation/fake_invalidation_service.h" |
20 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 21 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
21 #include "chrome/browser/sessions/session_tab_helper.h" | 22 #include "chrome/browser/sessions/session_tab_helper.h" |
22 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 23 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
23 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" | 24 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
24 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 25 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
26 #include "chrome/browser/signin/signin_manager.h" | 27 #include "chrome/browser/signin/signin_manager.h" |
27 #include "chrome/browser/signin/signin_manager_factory.h" | 28 #include "chrome/browser/signin/signin_manager_factory.h" |
28 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 29 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
29 #include "chrome/browser/sync/glue/device_info.h" | 30 #include "chrome/browser/sync/glue/device_info.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "ui/base/ui_base_types.h" | 67 #include "ui/base/ui_base_types.h" |
67 #include "url/gurl.h" | 68 #include "url/gurl.h" |
68 | 69 |
69 using browser_sync::SessionChangeProcessor; | 70 using browser_sync::SessionChangeProcessor; |
70 using browser_sync::SessionDataTypeController; | 71 using browser_sync::SessionDataTypeController; |
71 using browser_sync::SessionModelAssociator; | 72 using browser_sync::SessionModelAssociator; |
72 using browser_sync::SyncBackendHost; | 73 using browser_sync::SyncBackendHost; |
73 using content::BrowserThread; | 74 using content::BrowserThread; |
74 using content::WebContents; | 75 using content::WebContents; |
75 using syncer::ChangeRecord; | 76 using syncer::ChangeRecord; |
| 77 using testing::Return; |
76 using testing::_; | 78 using testing::_; |
77 using testing::Return; | |
78 | 79 |
79 namespace browser_sync { | 80 namespace browser_sync { |
80 | 81 |
81 namespace { | 82 namespace { |
82 | 83 |
83 class FakeProfileSyncService : public TestProfileSyncService { | 84 class FakeProfileSyncService : public TestProfileSyncService { |
84 public: | 85 public: |
85 FakeProfileSyncService( | 86 FakeProfileSyncService( |
86 ProfileSyncComponentsFactory* factory, | 87 ProfileSyncComponentsFactory* factory, |
87 Profile* profile, | 88 Profile* profile, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 136 |
136 protected: | 137 protected: |
137 virtual TestingProfile* CreateProfile() OVERRIDE { | 138 virtual TestingProfile* CreateProfile() OVERRIDE { |
138 TestingProfile::Builder builder; | 139 TestingProfile::Builder builder; |
139 builder.AddTestingFactory( | 140 builder.AddTestingFactory( |
140 ProfileOAuth2TokenServiceFactory::GetInstance(), | 141 ProfileOAuth2TokenServiceFactory::GetInstance(), |
141 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); | 142 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); |
142 // Don't want the profile to create a real ProfileSyncService. | 143 // Don't want the profile to create a real ProfileSyncService. |
143 builder.AddTestingFactory(ProfileSyncServiceFactory::GetInstance(), NULL); | 144 builder.AddTestingFactory(ProfileSyncServiceFactory::GetInstance(), NULL); |
144 scoped_ptr<TestingProfile> profile(builder.Build()); | 145 scoped_ptr<TestingProfile> profile(builder.Build()); |
145 invalidation::InvalidationServiceFactory::GetInstance()-> | 146 invalidation::InvalidationServiceFactory::GetInstance()->SetTestingFactory( |
146 SetBuildOnlyFakeInvalidatorsForTest(true); | 147 profile.get(), invalidation::FakeInvalidationService::Build); |
147 return profile.release(); | 148 return profile.release(); |
148 } | 149 } |
149 | 150 |
150 virtual void SetUp() { | 151 virtual void SetUp() { |
151 // BrowserWithTestWindowTest implementation. | 152 // BrowserWithTestWindowTest implementation. |
152 BrowserWithTestWindowTest::SetUp(); | 153 BrowserWithTestWindowTest::SetUp(); |
153 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 154 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
154 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, | 155 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, |
155 content::NotificationService::AllSources()); | 156 content::NotificationService::AllSources()); |
156 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, | 157 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 tab_node.SetSessionSpecifics(specifics); | 1287 tab_node.SetSessionSpecifics(specifics); |
1287 } | 1288 } |
1288 | 1289 |
1289 error = model_associator_->DisassociateModels(); | 1290 error = model_associator_->DisassociateModels(); |
1290 ASSERT_FALSE(error.IsSet()); | 1291 ASSERT_FALSE(error.IsSet()); |
1291 error = model_associator_->AssociateModels(NULL, NULL); | 1292 error = model_associator_->AssociateModels(NULL, NULL); |
1292 ASSERT_FALSE(error.IsSet()); | 1293 ASSERT_FALSE(error.IsSet()); |
1293 } | 1294 } |
1294 | 1295 |
1295 } // namespace browser_sync | 1296 } // namespace browser_sync |
OLD | NEW |