| 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 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 8 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 9 #include "ios/chrome/grit/ios_strings.h" | 9 #include "ios/chrome/grit/ios_strings.h" |
| 10 #include "ios/web/public/test/test_web_thread_bundle.h" | 10 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 namespace { | 16 namespace { |
| 13 | 17 |
| 14 class ContentSettingsCollectionViewControllerTest | 18 class ContentSettingsCollectionViewControllerTest |
| 15 : public CollectionViewControllerTest { | 19 : public CollectionViewControllerTest { |
| 16 protected: | 20 protected: |
| 17 void SetUp() override { | 21 void SetUp() override { |
| 18 CollectionViewControllerTest::SetUp(); | 22 CollectionViewControllerTest::SetUp(); |
| 19 TestChromeBrowserState::Builder test_cbs_builder; | 23 TestChromeBrowserState::Builder test_cbs_builder; |
| 20 chrome_browser_state_ = test_cbs_builder.Build(); | 24 chrome_browser_state_ = test_cbs_builder.Build(); |
| 21 } | 25 } |
| 22 | 26 |
| 23 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 27 CollectionViewController* InstantiateController() override { |
| 24 return [[ContentSettingsCollectionViewController alloc] | 28 return [[ContentSettingsCollectionViewController alloc] |
| 25 initWithBrowserState:chrome_browser_state_.get()]; | 29 initWithBrowserState:chrome_browser_state_.get()]; |
| 26 } | 30 } |
| 27 | 31 |
| 28 private: | 32 private: |
| 29 web::TestWebThreadBundle thread_bundle_; | 33 web::TestWebThreadBundle thread_bundle_; |
| 30 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; | 34 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; |
| 31 }; | 35 }; |
| 32 | 36 |
| 33 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) { | 37 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) { |
| 34 CreateController(); | 38 CreateController(); |
| 35 CheckController(); | 39 CheckController(); |
| 36 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE); | 40 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE); |
| 37 | 41 |
| 38 int expectedNumberOfItems = 2; | 42 int expectedNumberOfItems = 2; |
| 39 ASSERT_EQ(1, NumberOfSections()); | 43 ASSERT_EQ(1, NumberOfSections()); |
| 40 EXPECT_EQ(expectedNumberOfItems, NumberOfItemsInSection(0)); | 44 EXPECT_EQ(expectedNumberOfItems, NumberOfItemsInSection(0)); |
| 41 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0); | 45 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0); |
| 42 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0, | 46 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0, |
| 43 1); | 47 1); |
| 44 } | 48 } |
| 45 | 49 |
| 46 } // namespace | 50 } // namespace |
| OLD | NEW |