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

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

Issue 2592173002: Fix ios_chrome_unittests to crash on DCHECK failure. (Closed)
Patch Set: Address comments Created 4 years 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/privacy_collection_view_controller.h" 5 #import "ios/chrome/browser/ui/settings/privacy_collection_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/ios/ios_util.h" 9 #include "base/ios/ios_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "components/handoff/pref_names_ios.h" 12 #include "components/handoff/pref_names_ios.h"
13 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
14 #include "components/sync_preferences/pref_service_mock_factory.h" 14 #include "components/sync_preferences/pref_service_mock_factory.h"
15 #include "components/sync_preferences/pref_service_syncable.h" 15 #include "components/sync_preferences/pref_service_syncable.h"
16 #include "ios/chrome/browser/application_context.h" 16 #include "ios/chrome/browser/application_context.h"
17 #import "ios/chrome/browser/autofill/autofill_controller.h" 17 #import "ios/chrome/browser/autofill/autofill_controller.h"
18 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" 18 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
19 #include "ios/chrome/browser/experimental_flags.h" 19 #include "ios/chrome/browser/experimental_flags.h"
20 #include "ios/chrome/browser/pref_names.h" 20 #include "ios/chrome/browser/pref_names.h"
21 #include "ios/chrome/browser/prefs/browser_prefs.h" 21 #include "ios/chrome/browser/prefs/browser_prefs.h"
22 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h " 22 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h "
23 #import "ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_med iator.h" 23 #import "ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_med iator.h"
24 #import "ios/chrome/browser/ui/settings/physical_web_collection_view_controller. h" 24 #import "ios/chrome/browser/ui/settings/physical_web_collection_view_controller. h"
25 #include "ios/chrome/grit/ios_chromium_strings.h" 25 #include "ios/chrome/grit/ios_chromium_strings.h"
26 #include "ios/chrome/grit/ios_strings.h" 26 #include "ios/chrome/grit/ios_strings.h"
27 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
27 #include "ios/web/public/test/test_web_thread_bundle.h" 28 #include "ios/web/public/test/test_web_thread_bundle.h"
28 #include "ios/web/public/web_capabilities.h" 29 #include "ios/web/public/web_capabilities.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 32
32 namespace { 33 namespace {
33 34
34 NSString* const kSpdyProxyEnabled = @"SpdyProxyEnabled"; 35 NSString* const kSpdyProxyEnabled = @"SpdyProxyEnabled";
35 36
36 class PrivacyCollectionViewControllerTest 37 class PrivacyCollectionViewControllerTest
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 sync_preferences::PrefServiceMockFactory factory; 70 sync_preferences::PrefServiceMockFactory factory;
70 return factory.CreateSyncable(registry.get()); 71 return factory.CreateSyncable(registry.get());
71 } 72 }
72 73
73 CollectionViewController* NewController() override { 74 CollectionViewController* NewController() override {
74 return [[PrivacyCollectionViewController alloc] 75 return [[PrivacyCollectionViewController alloc]
75 initWithBrowserState:chrome_browser_state_.get()]; 76 initWithBrowserState:chrome_browser_state_.get()];
76 } 77 }
77 78
78 web::TestWebThreadBundle thread_bundle_; 79 web::TestWebThreadBundle thread_bundle_;
80 IOSChromeScopedTestingLocalState local_state_;
79 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; 81 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
80 base::scoped_nsobject<NSString> initialValueForSpdyProxyEnabled_; 82 base::scoped_nsobject<NSString> initialValueForSpdyProxyEnabled_;
81 }; 83 };
82 84
83 // Tests PrivacyCollectionViewController is set up with all appropriate items 85 // Tests PrivacyCollectionViewController is set up with all appropriate items
84 // and sections. 86 // and sections.
85 TEST_F(PrivacyCollectionViewControllerTest, TestModel) { 87 TEST_F(PrivacyCollectionViewControllerTest, TestModel) {
86 CheckController(); 88 CheckController();
87 EXPECT_EQ(4, NumberOfSections()); 89 EXPECT_EQ(4, NumberOfSections());
88 90
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex)); 161 EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex));
160 CheckSectionFooterWithId(IDS_IOS_OPTIONS_PRIVACY_FOOTER, sectionIndex); 162 CheckSectionFooterWithId(IDS_IOS_OPTIONS_PRIVACY_FOOTER, sectionIndex);
161 163
162 sectionIndex++; 164 sectionIndex++;
163 EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex)); 165 EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex));
164 CheckTextCellTitle(l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE), 166 CheckTextCellTitle(l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE),
165 sectionIndex, 0); 167 sectionIndex, 0);
166 } 168 }
167 169
168 } // namespace 170 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/settings/personal_data_manager_data_changed_observer.cc ('k') | ios/chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698