Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: ios/chrome/browser/ui/settings/content_settings_collection_view_controller_unittest.mm

Issue 2870783002: Adds Compose Email Settings UI for deprecating Native App Launcher (Closed)
Patch Set: replied to comments from rohitrao Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/collection_view_controller_test.h " 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h "
9 #include "ios/chrome/grit/ios_strings.h" 11 #include "ios/chrome/grit/ios_strings.h"
10 #include "ios/web/public/test/test_web_thread_bundle.h" 12 #include "ios/web/public/test/test_web_thread_bundle.h"
13 #include "testing/gtest_mac.h"
14 #include "ui/base/l10n/l10n_util.h"
11 15
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 16 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 17 #error "This file requires ARC support."
14 #endif 18 #endif
15 19
16 namespace { 20 namespace {
17 21
18 class ContentSettingsCollectionViewControllerTest 22 class ContentSettingsCollectionViewControllerTest
19 : public CollectionViewControllerTest { 23 : public CollectionViewControllerTest {
20 protected: 24 protected:
(...skipping 11 matching lines...) Expand all
32 private: 36 private:
33 web::TestWebThreadBundle thread_bundle_; 37 web::TestWebThreadBundle thread_bundle_;
34 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; 38 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
35 }; 39 };
36 40
37 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) { 41 TEST_F(ContentSettingsCollectionViewControllerTest, TestModel) {
38 CreateController(); 42 CreateController();
39 CheckController(); 43 CheckController();
40 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE); 44 CheckTitleWithId(IDS_IOS_CONTENT_SETTINGS_TITLE);
41 45
42 int expectedNumberOfItems = 2;
43 ASSERT_EQ(1, NumberOfSections()); 46 ASSERT_EQ(1, NumberOfSections());
47 // Compose Email section is shown only if experiment is turned on and
48 // there are enough number of available mailto: URL handlers.
49 int number_of_handlers =
50 [[[[MailtoURLRewriter alloc] initWithStandardHandlers] defaultHandlers]
51 count];
52 bool show_compose_email_section =
53 experimental_flags::IsNativeAppLauncherEnabled() &&
54 number_of_handlers > 1;
55 int expectedNumberOfItems = show_compose_email_section ? 3 : 2;
44 EXPECT_EQ(expectedNumberOfItems, NumberOfItemsInSection(0)); 56 EXPECT_EQ(expectedNumberOfItems, NumberOfItemsInSection(0));
45 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0); 57 CheckDetailItemTextWithIds(IDS_IOS_BLOCK_POPUPS, IDS_IOS_SETTING_ON, 0, 0);
46 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0, 58 CheckDetailItemTextWithIds(IDS_IOS_TRANSLATE_SETTING, IDS_IOS_SETTING_ON, 0,
47 1); 59 1);
60 if (show_compose_email_section) {
61 CollectionViewDetailItem* item = GetCollectionViewItem(0, 2);
62 EXPECT_NSEQ(l10n_util::GetNSString(IDS_IOS_COMPOSE_EMAIL_SETTING),
63 item.text);
64 }
48 } 65 }
49 66
50 } // namespace 67 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/settings/content_settings_collection_view_controller.mm ('k') | ios/chrome/browser/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698