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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 59793008: sync: don't allow NULL profile in ProfileSyncService and friends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.cc ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 EXPECT_TRUE( 188 EXPECT_TRUE(
189 service_->sync_service_url().spec() == 189 service_->sync_service_url().spec() ==
190 ProfileSyncService::kSyncServerUrl || 190 ProfileSyncService::kSyncServerUrl ||
191 service_->sync_service_url().spec() == 191 service_->sync_service_url().spec() ==
192 ProfileSyncService::kDevServerUrl); 192 ProfileSyncService::kDevServerUrl);
193 } 193 }
194 194
195 // Tests that the sync service doesn't forget to notify observers about 195 // Tests that the sync service doesn't forget to notify observers about
196 // setup state. 196 // setup state.
197 TEST(ProfileSyncServiceTestBasic, SetupInProgress) { 197 TEST(ProfileSyncServiceTestBasic, SetupInProgress) {
198 scoped_ptr<TestingProfile> profile(new TestingProfile());
198 ProfileSyncService service( 199 ProfileSyncService service(
199 NULL, NULL, NULL, NULL, ProfileSyncService::MANUAL_START); 200 NULL, profile.get(), NULL, NULL,
201 ProfileSyncService::MANUAL_START);
200 TestProfileSyncServiceObserver observer(&service); 202 TestProfileSyncServiceObserver observer(&service);
201 service.AddObserver(&observer); 203 service.AddObserver(&observer);
202 service.SetSetupInProgress(true); 204 service.SetSetupInProgress(true);
203 EXPECT_TRUE(observer.first_setup_in_progress()); 205 EXPECT_TRUE(observer.first_setup_in_progress());
204 service.SetSetupInProgress(false); 206 service.SetSetupInProgress(false);
205 EXPECT_FALSE(observer.first_setup_in_progress()); 207 EXPECT_FALSE(observer.first_setup_in_progress());
206 service.RemoveObserver(&observer); 208 service.RemoveObserver(&observer);
207 } 209 }
208 210
209 TEST_F(ProfileSyncServiceTest, DisabledByPolicy) { 211 TEST_F(ProfileSyncServiceTest, DisabledByPolicy) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 EXPECT_TRUE(token_status.next_token_request_time.is_null()); 516 EXPECT_TRUE(token_status.next_token_request_time.is_null());
515 517
516 // Simulate successful connection. 518 // Simulate successful connection.
517 service_->OnConnectionStatusChange(syncer::CONNECTION_OK); 519 service_->OnConnectionStatusChange(syncer::CONNECTION_OK);
518 token_status = service_->GetSyncTokenStatus(); 520 token_status = service_->GetSyncTokenStatus();
519 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); 521 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status);
520 } 522 }
521 523
522 } // namespace 524 } // namespace
523 } // namespace browser_sync 525 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.cc ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698