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 "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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 profile->CreateRequestContext(); | 68 profile->CreateRequestContext(); |
69 | 69 |
70 // We need to set the user agent before the backend host can call | 70 // We need to set the user agent before the backend host can call |
71 // webkit_glue::GetUserAgent(). | 71 // webkit_glue::GetUserAgent(). |
72 webkit_glue::SetUserAgent(content::GetContentClient()->GetUserAgent(), | 72 webkit_glue::SetUserAgent(content::GetContentClient()->GetUserAgent(), |
73 false); | 73 false); |
74 } | 74 } |
75 | 75 |
76 void TearDown() { | 76 void TearDown() { |
77 // Kill the service before the profile. | 77 // Kill the service before the profile. |
| 78 if (service.get()) { |
| 79 service->Shutdown(); |
| 80 } |
78 service.reset(); | 81 service.reset(); |
79 profile.reset(); | 82 profile.reset(); |
80 // Pump messages posted by the sync thread (which may end up | 83 // Pump messages posted by the sync thread (which may end up |
81 // posting on the IO thread). | 84 // posting on the IO thread). |
82 ui_loop_.RunAllPending(); | 85 ui_loop_.RunAllPending(); |
83 io_thread_.Stop(); | 86 io_thread_.Stop(); |
84 file_thread_.Stop(); | 87 file_thread_.Stop(); |
85 // Ensure that the sync objects destruct to avoid memory leaks. | 88 // Ensure that the sync objects destruct to avoid memory leaks. |
86 ui_loop_.RunAllPending(); | 89 ui_loop_.RunAllPending(); |
87 } | 90 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 syncer::STORAGE_ON_DISK); | 366 syncer::STORAGE_ON_DISK); |
364 EXPECT_FALSE(harness_.service->HasSyncSetupCompleted()); | 367 EXPECT_FALSE(harness_.service->HasSyncSetupCompleted()); |
365 EXPECT_FALSE(harness_.service->sync_initialized()); | 368 EXPECT_FALSE(harness_.service->sync_initialized()); |
366 | 369 |
367 // Since we're doing synchronous initialization, backend should be | 370 // Since we're doing synchronous initialization, backend should be |
368 // initialized by this call. | 371 // initialized by this call. |
369 harness_.IssueTestTokens(); | 372 harness_.IssueTestTokens(); |
370 | 373 |
371 // Stop the service so we can read the new Sync Data files that were | 374 // Stop the service so we can read the new Sync Data files that were |
372 // created. | 375 // created. |
| 376 harness_.service->Shutdown(); |
373 harness_.service.reset(); | 377 harness_.service.reset(); |
374 | 378 |
375 // This file should have been deleted when the whole directory was nuked. | 379 // This file should have been deleted when the whole directory was nuked. |
376 ASSERT_FALSE(file_util::PathExists(sync_file3)); | 380 ASSERT_FALSE(file_util::PathExists(sync_file3)); |
377 ASSERT_FALSE(file_util::PathExists(sync_file1)); | 381 ASSERT_FALSE(file_util::PathExists(sync_file1)); |
378 | 382 |
379 // This will still exist, but the text should have changed. | 383 // This will still exist, but the text should have changed. |
380 ASSERT_TRUE(file_util::PathExists(sync_file2)); | 384 ASSERT_TRUE(file_util::PathExists(sync_file2)); |
381 std::string file2text; | 385 std::string file2text; |
382 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); | 386 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 namespace syncer { | 545 namespace syncer { |
542 namespace { | 546 namespace { |
543 | 547 |
544 // ProfileSyncService should behave just like an invalidator. | 548 // ProfileSyncService should behave just like an invalidator. |
545 INSTANTIATE_TYPED_TEST_CASE_P( | 549 INSTANTIATE_TYPED_TEST_CASE_P( |
546 ProfileSyncServiceInvalidatorTest, InvalidatorTest, | 550 ProfileSyncServiceInvalidatorTest, InvalidatorTest, |
547 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate); | 551 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate); |
548 | 552 |
549 } // namespace | 553 } // namespace |
550 } // namespace syncer | 554 } // namespace syncer |
OLD | NEW |