| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/settings/sync_settings_collection_view_controller
.h" | 5 #import "ios/chrome/browser/ui/settings/sync_settings_collection_view_controller
.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 TurnSyncEverythingOn(); | 223 TurnSyncEverythingOn(); |
| 224 TurnSyncOn(); | 224 TurnSyncOn(); |
| 225 SyncSettingsCollectionViewController* sync_controller = | 225 SyncSettingsCollectionViewController* sync_controller = |
| 226 CreateSyncController(); | 226 CreateSyncController(); |
| 227 | 227 |
| 228 EXPECT_EQ(3, NumberOfSections()); | 228 EXPECT_EQ(3, NumberOfSections()); |
| 229 | 229 |
| 230 EXPECT_EQ(1, NumberOfItemsInSection(0)); | 230 EXPECT_EQ(1, NumberOfItemsInSection(0)); |
| 231 int expected_number_of_items = | 231 int expected_number_of_items = |
| 232 SyncSetupService::kNumberOfSyncableDatatypes + 1; | 232 SyncSetupService::kNumberOfSyncableDatatypes + 1; |
| 233 if (!experimental_flags::IsReadingListEnabled()) | |
| 234 expected_number_of_items--; | |
| 235 EXPECT_EQ(expected_number_of_items, NumberOfItemsInSection(1)); | 233 EXPECT_EQ(expected_number_of_items, NumberOfItemsInSection(1)); |
| 236 EXPECT_EQ(2, NumberOfItemsInSection(2)); | 234 EXPECT_EQ(2, NumberOfItemsInSection(2)); |
| 237 | 235 |
| 238 SyncSwitchItem* syncItem = GetCollectionViewItem(0, 0); | 236 SyncSwitchItem* syncItem = GetCollectionViewItem(0, 0); |
| 239 EXPECT_EQ(syncItem.isOn, YES); | 237 EXPECT_EQ(syncItem.isOn, YES); |
| 240 EXPECT_NSEQ(syncItem.text, | 238 EXPECT_NSEQ(syncItem.text, |
| 241 l10n_util::GetNSString(IDS_IOS_SYNC_SETTING_TITLE)); | 239 l10n_util::GetNSString(IDS_IOS_SYNC_SETTING_TITLE)); |
| 242 EXPECT_NSEQ( | 240 EXPECT_NSEQ( |
| 243 syncItem.detailText, | 241 syncItem.detailText, |
| 244 l10n_util::GetNSString(IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SUBTITLE)); | 242 l10n_util::GetNSString(IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SUBTITLE)); |
| 245 | 243 |
| 246 SyncSwitchItem* syncEverythingItem = GetCollectionViewItem(1, 0); | 244 SyncSwitchItem* syncEverythingItem = GetCollectionViewItem(1, 0); |
| 247 EXPECT_EQ(syncEverythingItem.isOn, YES); | 245 EXPECT_EQ(syncEverythingItem.isOn, YES); |
| 248 EXPECT_NSEQ(syncEverythingItem.text, | 246 EXPECT_NSEQ(syncEverythingItem.text, |
| 249 l10n_util::GetNSString(IDS_IOS_SYNC_EVERYTHING_TITLE)); | 247 l10n_util::GetNSString(IDS_IOS_SYNC_EVERYTHING_TITLE)); |
| 250 | 248 |
| 251 int item = 1; | 249 int item = 1; |
| 252 for (int i = 0; i < SyncSetupService::kNumberOfSyncableDatatypes; i++) { | 250 for (int i = 0; i < SyncSetupService::kNumberOfSyncableDatatypes; i++) { |
| 253 SyncSetupService::SyncableDatatype dataType = | 251 SyncSetupService::SyncableDatatype dataType = |
| 254 static_cast<SyncSetupService::SyncableDatatype>(i); | 252 static_cast<SyncSetupService::SyncableDatatype>(i); |
| 255 if (!experimental_flags::IsReadingListEnabled() && | |
| 256 dataType == SyncSetupService::kSyncReadingList) { | |
| 257 // Display Reading List only if it is enabled. | |
| 258 continue; | |
| 259 } | |
| 260 SyncSwitchItem* syncDataTypeItem = GetCollectionViewItem(1, item++); | 253 SyncSwitchItem* syncDataTypeItem = GetCollectionViewItem(1, item++); |
| 261 EXPECT_NSEQ(syncDataTypeItem.text, | 254 EXPECT_NSEQ(syncDataTypeItem.text, |
| 262 l10n_util::GetNSString( | 255 l10n_util::GetNSString( |
| 263 [sync_controller titleIdForSyncableDataType:dataType])); | 256 [sync_controller titleIdForSyncableDataType:dataType])); |
| 264 } | 257 } |
| 265 TextAndErrorItem* encryptionItem = GetCollectionViewItem(2, 0); | 258 TextAndErrorItem* encryptionItem = GetCollectionViewItem(2, 0); |
| 266 EXPECT_NSEQ(encryptionItem.text, | 259 EXPECT_NSEQ(encryptionItem.text, |
| 267 l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_TITLE)); | 260 l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_TITLE)); |
| 268 CheckErrorIcon(NO, 2, 0); | 261 CheckErrorIcon(NO, 2, 0); |
| 269 } | 262 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 350 |
| 358 TurnSyncErrorOff(); | 351 TurnSyncErrorOff(); |
| 359 [sync_controller onSyncStateChanged]; | 352 [sync_controller onSyncStateChanged]; |
| 360 encryptionItem = GetCollectionViewItem(2, 0); | 353 encryptionItem = GetCollectionViewItem(2, 0); |
| 361 EXPECT_NSEQ(encryptionItem.text, | 354 EXPECT_NSEQ(encryptionItem.text, |
| 362 l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_TITLE)); | 355 l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_TITLE)); |
| 363 CheckErrorIcon(NO, 2, 0); | 356 CheckErrorIcon(NO, 2, 0); |
| 364 } | 357 } |
| 365 | 358 |
| 366 } // namespace | 359 } // namespace |
| OLD | NEW |