OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bandwidth_management_collection_view_con
troller.h" | 5 #import "ios/chrome/browser/ui/settings/bandwidth_management_collection_view_con
troller.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/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/test/test_simple_task_runner.h" | 11 #include "base/test/test_simple_task_runner.h" |
12 #include "components/pref_registry/pref_registry_syncable.h" | 12 #include "components/pref_registry/pref_registry_syncable.h" |
13 #include "components/prefs/testing_pref_service.h" | 13 #include "components/prefs/testing_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/browser_state/test_chrome_browser_state.h" | 16 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
17 #include "ios/chrome/browser/pref_names.h" | 17 #include "ios/chrome/browser/pref_names.h" |
18 #include "ios/chrome/browser/prefs/browser_prefs.h" | 18 #include "ios/chrome/browser/prefs/browser_prefs.h" |
19 #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
" |
20 #import "ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controlle
r.h" | 20 #import "ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controlle
r.h" |
21 #include "ios/chrome/grit/ios_strings.h" | 21 #include "ios/chrome/grit/ios_strings.h" |
22 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" | 22 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" |
23 #include "ios/chrome/test/testing_application_context.h" | 23 #include "ios/chrome/test/testing_application_context.h" |
24 #include "ios/web/public/test/test_web_thread.h" | 24 #include "ios/web/public/test/test_web_thread.h" |
25 #include "net/log/test_net_log.h" | 25 #include "net/log/test_net_log.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 | 28 |
| 29 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 30 #error "This file requires ARC support." |
| 31 #endif |
| 32 |
29 namespace { | 33 namespace { |
30 | 34 |
31 class BandwidthManagementCollectionViewControllerTest | 35 class BandwidthManagementCollectionViewControllerTest |
32 : public CollectionViewControllerTest { | 36 : public CollectionViewControllerTest { |
33 public: | 37 public: |
34 BandwidthManagementCollectionViewControllerTest() | 38 BandwidthManagementCollectionViewControllerTest() |
35 : loop_(base::MessageLoop::TYPE_IO), | 39 : loop_(base::MessageLoop::TYPE_IO), |
36 ui_thread_(web::WebThread::UI, &loop_), | 40 ui_thread_(web::WebThread::UI, &loop_), |
37 io_thread_(web::WebThread::IO, &loop_) {} | 41 io_thread_(web::WebThread::IO, &loop_) {} |
38 | 42 |
(...skipping 12 matching lines...) Expand all Loading... |
51 chrome_browser_state_ = test_cbs_builder.Build(); | 55 chrome_browser_state_ = test_cbs_builder.Build(); |
52 | 56 |
53 CreateController(); | 57 CreateController(); |
54 } | 58 } |
55 | 59 |
56 void TearDown() override { | 60 void TearDown() override { |
57 base::RunLoop().RunUntilIdle(); | 61 base::RunLoop().RunUntilIdle(); |
58 CollectionViewControllerTest::TearDown(); | 62 CollectionViewControllerTest::TearDown(); |
59 } | 63 } |
60 | 64 |
61 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 65 CollectionViewController* InstantiateController() override { |
62 return [[BandwidthManagementCollectionViewController alloc] | 66 return [[BandwidthManagementCollectionViewController alloc] |
63 initWithBrowserState:chrome_browser_state_.get()]; | 67 initWithBrowserState:chrome_browser_state_.get()]; |
64 } | 68 } |
65 | 69 |
66 base::MessageLoop loop_; | 70 base::MessageLoop loop_; |
67 web::TestWebThread ui_thread_; | 71 web::TestWebThread ui_thread_; |
68 web::TestWebThread io_thread_; | 72 web::TestWebThread io_thread_; |
69 net::TestNetLog net_log_; | 73 net::TestNetLog net_log_; |
70 IOSChromeScopedTestingLocalState local_state_; | 74 IOSChromeScopedTestingLocalState local_state_; |
71 | 75 |
(...skipping 11 matching lines...) Expand all Loading... |
83 l10n_util::GetNSString(IDS_IOS_OPTIONS_PRELOAD_WEBPAGES); | 87 l10n_util::GetNSString(IDS_IOS_OPTIONS_PRELOAD_WEBPAGES); |
84 NSString* expected_subtitle = [DataplanUsageCollectionViewController | 88 NSString* expected_subtitle = [DataplanUsageCollectionViewController |
85 currentLabelForPreference:chrome_browser_state_->GetPrefs() | 89 currentLabelForPreference:chrome_browser_state_->GetPrefs() |
86 basePref:prefs::kNetworkPredictionEnabled | 90 basePref:prefs::kNetworkPredictionEnabled |
87 wifiPref:prefs::kNetworkPredictionWifiOnly]; | 91 wifiPref:prefs::kNetworkPredictionWifiOnly]; |
88 CheckTextCellTitleAndSubtitle(expected_title, expected_subtitle, | 92 CheckTextCellTitleAndSubtitle(expected_title, expected_subtitle, |
89 action_section, 0); | 93 action_section, 0); |
90 } | 94 } |
91 | 95 |
92 } // namespace | 96 } // namespace |
OLD | NEW |