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