Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include "base/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.h" | |
| 10 #include "testing/gmock/include/gmock/gmock.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 | |
| 13 using ::testing::NiceMock; | |
|
akalin
2012/07/12 00:01:55
namespace sync_ui_util { namespace { } } ?
rlarocque
2012/07/12 01:02:20
Done, mostly. I left the using declarations out o
| |
| 14 using ::testing::Return; | |
| 15 using ::testing::_; | |
| 16 using content::BrowserThread; | |
| 17 | |
| 18 TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) { | |
| 19 MessageLoopForUI message_loop; | |
| 20 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | |
| 21 scoped_ptr<Profile> profile( | |
| 22 ProfileSyncServiceMock::MakeSignedInTestingProfile()); | |
| 23 NiceMock<ProfileSyncServiceMock> service(profile.get()); | |
| 24 | |
| 25 // Will be released when the dictionary is destroyed | |
|
akalin
2012/07/12 00:01:55
hunh?
rlarocque
2012/07/12 01:02:20
That was there when I copied this test out of sync
| |
| 26 string16 str(ASCIIToUTF16("none")); | |
| 27 | |
| 28 browser_sync::SyncBackendHost::Status status; | |
| 29 | |
| 30 EXPECT_CALL(service, HasSyncSetupCompleted()) | |
| 31 .WillOnce(Return(true)); | |
| 32 EXPECT_CALL(service, QueryDetailedSyncStatus(_)) | |
| 33 .WillOnce(Return(false)); | |
| 34 | |
| 35 EXPECT_CALL(service, HasUnrecoverableError()) | |
| 36 .WillRepeatedly(Return(true)); | |
| 37 | |
| 38 EXPECT_CALL(service, GetLastSyncedTimeString()) | |
| 39 .WillOnce(Return(str)); | |
| 40 | |
| 41 scoped_ptr<DictionaryValue> strings( | |
| 42 sync_ui_util::ConstructAboutInformation(&service)); | |
| 43 | |
| 44 EXPECT_TRUE(strings->HasKey("unrecoverable_error_detected")); | |
| 45 } | |
| OLD | NEW |