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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc

Issue 288193002: [SyncFS] Construct and destruct sync_worker in worker_task_runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 #include <stack> 6 #include <stack>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 fake_drive_service_helper_.reset(new FakeDriveServiceHelper( 75 fake_drive_service_helper_.reset(new FakeDriveServiceHelper(
76 drive_service.get(), uploader.get(), 76 drive_service.get(), uploader.get(),
77 kSyncRootFolderTitle)); 77 kSyncRootFolderTitle));
78 78
79 remote_sync_service_.reset(new SyncEngine( 79 remote_sync_service_.reset(new SyncEngine(
80 drive_service.PassAs<drive::DriveServiceInterface>(), 80 drive_service.PassAs<drive::DriveServiceInterface>(),
81 uploader.Pass(), 81 uploader.Pass(),
82 file_task_runner_.get(), 82 file_task_runner_.get(),
83 NULL, NULL, NULL)); 83 NULL, NULL, NULL));
84 remote_sync_service_->AddServiceObserver(this); 84 remote_sync_service_->AddServiceObserver(this);
85
86 base::RunLoop run_loop;
85 remote_sync_service_->Initialize(base_dir_.path(), 87 remote_sync_service_->Initialize(base_dir_.path(),
86 base::MessageLoopProxy::current(), 88 base::MessageLoopProxy::current(),
89 run_loop.QuitClosure(),
87 in_memory_env_.get()); 90 in_memory_env_.get());
91 run_loop.Run();
92
88 remote_sync_service_->SetSyncEnabled(true); 93 remote_sync_service_->SetSyncEnabled(true);
89
90 local_sync_service_->SetLocalChangeProcessor(remote_sync_service_.get()); 94 local_sync_service_->SetLocalChangeProcessor(remote_sync_service_.get());
91 remote_sync_service_->SetRemoteChangeProcessor(local_sync_service_.get()); 95 remote_sync_service_->SetRemoteChangeProcessor(local_sync_service_.get());
92 } 96 }
93 97
94 virtual void TearDown() OVERRIDE { 98 virtual void TearDown() OVERRIDE {
95 typedef std::map<std::string, CannedSyncableFileSystem*>::iterator iterator; 99 typedef std::map<std::string, CannedSyncableFileSystem*>::iterator iterator;
96 for (iterator itr = file_systems_.begin(); 100 for (iterator itr = file_systems_.begin();
97 itr != file_systems_.end(); ++itr) { 101 itr != file_systems_.end(); ++itr) {
98 itr->second->TearDown(); 102 itr->second->TearDown();
99 delete itr->second; 103 delete itr->second;
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1579
1576 EXPECT_EQ(1u, CountApp()); 1580 EXPECT_EQ(1u, CountApp());
1577 EXPECT_EQ(1u, CountLocalFile(app_id)); 1581 EXPECT_EQ(1u, CountLocalFile(app_id));
1578 1582
1579 EXPECT_EQ(2u, CountMetadata()); 1583 EXPECT_EQ(2u, CountMetadata());
1580 EXPECT_EQ(2u, CountTracker()); 1584 EXPECT_EQ(2u, CountTracker());
1581 } 1585 }
1582 1586
1583 } // namespace drive_backend 1587 } // namespace drive_backend
1584 } // namespace sync_file_system 1588 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698