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