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

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

Issue 2806323003: [ObjC ARC] Converts ios/chrome/browser/ui/settings:unit_tests to ARC. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/voicesearch_collection_view_controller.h " 5 #import "ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.h "
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #import "base/mac/scoped_nsobject.h"
13 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
14 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
15 #include "components/prefs/pref_member.h" 14 #include "components/prefs/pref_member.h"
16 #include "components/prefs/pref_registry_simple.h" 15 #include "components/prefs/pref_registry_simple.h"
17 #include "components/prefs/testing_pref_service.h" 16 #include "components/prefs/testing_pref_service.h"
18 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h" 17 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h"
19 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" 18 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
20 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h " 19 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h "
21 #include "ios/chrome/browser/voice/speech_input_locale_config_impl.h" 20 #include "ios/chrome/browser/voice/speech_input_locale_config_impl.h"
22 #include "ios/public/provider/chrome/browser/voice/voice_search_prefs.h" 21 #include "ios/public/provider/chrome/browser/voice/voice_search_prefs.h"
23 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
24 #import "testing/gtest_mac.h" 23 #import "testing/gtest_mac.h"
25 #include "testing/platform_test.h" 24 #include "testing/platform_test.h"
26 #include "ui/base/l10n/l10n_util_mac.h" 25 #include "ui/base/l10n/l10n_util_mac.h"
27 26
27 #if !defined(__has_feature) || !__has_feature(objc_arc)
28 #error "This file requires ARC support."
29 #endif
30
28 namespace { 31 namespace {
29 32
30 class VoicesearchCollectionViewControllerTest 33 class VoicesearchCollectionViewControllerTest
31 : public CollectionViewControllerTest { 34 : public CollectionViewControllerTest {
32 protected: 35 protected:
33 void SetUp() override { 36 void SetUp() override {
34 CollectionViewControllerTest::SetUp(); 37 CollectionViewControllerTest::SetUp();
35 pref_service_ = CreateLocalState(); 38 pref_service_ = CreateLocalState();
36 } 39 }
37 40
38 CollectionViewController* NewController() override NS_RETURNS_RETAINED { 41 CollectionViewController* InstantiateController() override {
39 return [[VoicesearchCollectionViewController alloc] 42 return [[VoicesearchCollectionViewController alloc]
40 initWithPrefs:pref_service_.get()]; 43 initWithPrefs:pref_service_.get()];
41 } 44 }
42 45
43 std::unique_ptr<PrefService> CreateLocalState() { 46 std::unique_ptr<PrefService> CreateLocalState() {
44 TestingPrefServiceSimple* prefs = new TestingPrefServiceSimple(); 47 TestingPrefServiceSimple* prefs = new TestingPrefServiceSimple();
45 PrefRegistrySimple* registry = prefs->registry(); 48 PrefRegistrySimple* registry = prefs->registry();
46 registry->RegisterBooleanPref(prefs::kVoiceSearchTTS, false); 49 registry->RegisterBooleanPref(prefs::kVoiceSearchTTS, false);
47 registry->RegisterStringPref(prefs::kVoiceSearchLocale, "en-US"); 50 registry->RegisterStringPref(prefs::kVoiceSearchLocale, "en-US");
48 return std::unique_ptr<PrefService>(prefs); 51 return std::unique_ptr<PrefService>(prefs);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 textToSpeechEnabled.Init(prefs::kVoiceSearchTTS, pref_service_.get()); 140 textToSpeechEnabled.Init(prefs::kVoiceSearchTTS, pref_service_.get());
138 textToSpeechEnabled.SetValue(true); 141 textToSpeechEnabled.SetValue(true);
139 142
140 CreateController(); 143 CreateController();
141 CollectionViewSwitchItem* switchItem = GetCollectionViewItem(0, 0); 144 CollectionViewSwitchItem* switchItem = GetCollectionViewItem(0, 0);
142 EXPECT_TRUE(switchItem.isOn); 145 EXPECT_TRUE(switchItem.isOn);
143 EXPECT_FALSE(switchItem.isEnabled); 146 EXPECT_FALSE(switchItem.isEnabled);
144 } 147 }
145 148
146 } // namespace 149 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698