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