sync_ui_util_unittest.cc revision 731df977c0511bca2206b5f333555b1205ff1f43
1// Copyright (c) 2010 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. 4 5#include "base/basictypes.h" 6#include "chrome/browser/sync/sync_ui_util.h" 7#include "chrome/browser/sync/profile_sync_service_mock.h" 8#include "testing/gmock/include/gmock/gmock.h" 9#include "testing/gmock/include/gmock/gmock-actions.h" 10#include "testing/gtest/include/gtest/gtest.h" 11 12using ::testing::Return; 13using ::testing::NiceMock; 14TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) { 15 NiceMock<ProfileSyncServiceMock> service; 16 DictionaryValue strings; 17 18 // Will be released when the dictionary is destroyed 19 string16 str(ASCIIToUTF16("none")); 20 21 browser_sync::SyncBackendHost::Status status = 22 { browser_sync::SyncBackendHost::Status::OFFLINE_UNUSABLE }; 23 24 EXPECT_CALL(service, HasSyncSetupCompleted()) 25 .WillOnce(Return(true)); 26 EXPECT_CALL(service, QueryDetailedSyncStatus()) 27 .WillOnce(Return(status)); 28 29 EXPECT_CALL(service, unrecoverable_error_detected()) 30 .WillOnce(Return(true)); 31 32 EXPECT_CALL(service, GetLastSyncedTimeString()) 33 .WillOnce(Return(str)); 34 35 sync_ui_util::ConstructAboutInformation(&service, &strings); 36 37 EXPECT_TRUE(strings.HasKey("unrecoverable_error_detected")); 38} 39 40