| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content_settings_collection_view_control
ler.h" | 5 #import "ios/chrome/browser/ui/settings/content_settings_collection_view_control
ler.h" |
| 6 | 6 |
| 7 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 7 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
| 8 #include "ios/chrome/browser/experimental_flags.h" | |
| 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" | 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" |
| 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 9 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 11 #include "ios/chrome/grit/ios_strings.h" | 10 #include "ios/chrome/grit/ios_strings.h" |
| 12 #include "ios/web/public/test/test_web_thread_bundle.h" | 11 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 13 #include "testing/gtest_mac.h" | 12 #include "testing/gtest_mac.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 15 | 14 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." | 16 #error "This file requires ARC support." |
| 18 #endif | 17 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 web::TestWebThreadBundle thread_bundle_; | 36 web::TestWebThreadBundle thread_bundle_; |
| 38 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; | 37 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) { | 40 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) { |
| 42 CreateController(); | 41 CreateController(); |
| 43 CheckController(); | 42 CheckController(); |
| 44 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE); | 43 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE); |
| 45 | 44 |
| 46 ASSERT_EQ(1, NumberOfSections()); | 45 ASSERT_EQ(1, NumberOfSections()); |
| 47 // Compose Email section is shown only if experiment is turned on. | 46 EXPECT_EQ(3, NumberOfItemsInSection(0)); |
| 48 bool show_compose_email_section = | |
| 49 !experimental_flags::IsNativeAppLauncherEnabled(); | |
| 50 int expectedNumberOfItems = show_compose_email_section ? 3 : 2; | |
| 51 EXPECT_EQ(expectedNumberOfItems, NumberOfItemsInSection(0)); | |
| 52 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0); | 47 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0); |
| 53 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0, | 48 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0, |
| 54 1); | 49 1); |
| 55 if (show_compose_email_section) { | 50 CollectionViewDetailItem* item = GetCollectionViewItem(0, 2); |
| 56 CollectionViewDetailItem* item = GetCollectionViewItem(0, 2); | 51 EXPECT_NSEQ(l10n_util::GetNSString(IDS_IOS_COMPOSE_EMAIL_SETTING), item.text); |
| 57 EXPECT_NSEQ(l10n_util::GetNSString(IDS_IOS_COMPOSE_EMAIL_SETTING), | |
| 58 item.text); | |
| 59 } | |
| 60 } | 52 } |
| 61 | 53 |
| 62 } // namespace | 54 } // namespace |
| OLD | NEW |