Make sure the sync directory is deleted on sign-out.
[chromium-blink-merge.git] / chrome / browser / sync / about_sync_util_unittest.cc
blob63daaf4833a95b966eb1cee7fe6375e725171e37
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/strings/utf_string_conversions.h"
6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/sync/about_sync_util.h"
8 #include "chrome/browser/sync/profile_sync_service_mock.h"
9 #include "content/public/test/test_browser_thread_bundle.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using ::testing::NiceMock;
14 using ::testing::Return;
15 using ::testing::_;
17 namespace sync_ui_util {
18 namespace {
20 TEST(SyncUIUtilTestAbout, ConstructAboutInformationWithUnrecoverableErrorTest) {
21 content::TestBrowserThreadBundle thread_bundle(
22 content::TestBrowserThreadBundle::DEFAULT);
23 scoped_ptr<Profile> profile(
24 ProfileSyncServiceMock::MakeSignedInTestingProfile());
25 NiceMock<ProfileSyncServiceMock> service(profile.get());
27 // Will be released when the dictionary is destroyed
28 base::string16 str(base::ASCIIToUTF16("none"));
30 browser_sync::SyncBackendHost::Status status;
32 EXPECT_CALL(service, HasSyncSetupCompleted())
33 .WillOnce(Return(true));
34 EXPECT_CALL(service, QueryDetailedSyncStatus(_))
35 .WillOnce(Return(false));
36 EXPECT_CALL(service, GetLastSessionSnapshot())
37 .WillOnce(Return(syncer::sessions::SyncSessionSnapshot()));
38 EXPECT_CALL(service, HasUnrecoverableError()).WillRepeatedly(Return(true));
40 EXPECT_CALL(service, GetLastSyncedTimeString())
41 .WillOnce(Return(str));
43 scoped_ptr<base::DictionaryValue> strings(
44 ConstructAboutInformation(&service));
46 EXPECT_TRUE(strings->HasKey("unrecoverable_error_detected"));
49 } // namespace
50 } // namespace sync_ui_util