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
3 // found in the LICENSE file.
5 #include "base/synchronization/waitable_event.h"
6 #include "chrome/browser/sync/profile_sync_service.h"
7 #include "chrome/browser/sync/test/integration/sync_test.h"
8 #include "content/public/browser/browser_thread.h"
10 using content::BrowserThread
;
12 class SingleClientDirectorySyncTest
: public SyncTest
{
14 SingleClientDirectorySyncTest() : SyncTest(SINGLE_CLIENT
) {}
15 virtual ~SingleClientDirectorySyncTest() {}
18 DISALLOW_COPY_AND_ASSIGN(SingleClientDirectorySyncTest
);
21 void SignalEvent(base::WaitableEvent
* e
) {
25 void WaitForExistingTasksOnThread(BrowserThread::ID id
) {
26 base::WaitableEvent
e(true, false);
27 BrowserThread::PostTask(id
, FROM_HERE
, base::Bind(&SignalEvent
, &e
));
31 IN_PROC_BROWSER_TEST_F(SingleClientDirectorySyncTest
,
32 StopThenDisableDeletesDirectory
) {
33 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
34 ProfileSyncService
* sync_service
= GetSyncService(0);
35 base::FilePath directory_path
= sync_service
->GetDirectoryPathForTest();
36 ASSERT_TRUE(base::DirectoryExists(directory_path
));
37 sync_service
->StopAndSuppress();
38 sync_service
->DisableForUser();
39 // Wait for the deletion to finish.
40 WaitForExistingTasksOnThread(BrowserThread::FILE);
41 ASSERT_FALSE(base::DirectoryExists(directory_path
));