| 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 "components/sync_driver/about_sync_util.h" | |
| 6 | |
| 7 #include "base/strings/utf_string_conversions.h" | |
| 8 #include "components/sync/engine/sync_status.h" | |
| 9 #include "components/sync_driver/fake_sync_service.h" | |
| 10 #include "components/version_info/version_info.h" | |
| 11 #include "testing/gmock/include/gmock/gmock.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | |
| 14 using ::testing::NiceMock; | |
| 15 using ::testing::Return; | |
| 16 using ::testing::_; | |
| 17 | |
| 18 namespace sync_driver { | |
| 19 namespace sync_ui_util { | |
| 20 namespace { | |
| 21 | |
| 22 class SyncServiceMock : public sync_driver::FakeSyncService { | |
| 23 public: | |
| 24 bool IsFirstSetupComplete() const override { return true; } | |
| 25 | |
| 26 bool HasUnrecoverableError() const override { | |
| 27 return true; | |
| 28 } | |
| 29 | |
| 30 bool QueryDetailedSyncStatus(syncer::SyncStatus* result) override { | |
| 31 return false; | |
| 32 } | |
| 33 | |
| 34 base::string16 GetLastSyncedTimeString() const override { | |
| 35 return base::string16(base::ASCIIToUTF16("none")); | |
| 36 } | |
| 37 | |
| 38 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() | |
| 39 const override { | |
| 40 return syncer::sessions::SyncSessionSnapshot(); | |
| 41 } | |
| 42 }; | |
| 43 | |
| 44 TEST(SyncUIUtilTestAbout, ConstructAboutInformationWithUnrecoverableErrorTest) { | |
| 45 SyncServiceMock service; | |
| 46 | |
| 47 std::unique_ptr<base::DictionaryValue> strings(ConstructAboutInformation( | |
| 48 &service, NULL, version_info::Channel::UNKNOWN)); | |
| 49 | |
| 50 EXPECT_TRUE(strings->HasKey("unrecoverable_error_detected")); | |
| 51 } | |
| 52 | |
| 53 } // namespace | |
| 54 } // namespace sync_ui_util | |
| 55 } // namespace sync_driver | |
| OLD | NEW |