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

Unified Diff: ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm

Issue 2680403003: [ObjC ARC] Converts ios/chrome/browser/ui/settings/utils:unit_tests to ARC. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
diff --git a/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm b/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
index b389227016d87f7f4311da003ad32784527032bc..9f631ca343dca7ba3ba05898ab0427157071ec5a 100644
--- a/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
+++ b/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
@@ -4,7 +4,6 @@
#import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h"
-#import "base/mac/scoped_nsobject.h"
#include "base/values.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
@@ -13,6 +12,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
const char kTestSwitchPref[] = "test-pref";
@@ -21,9 +24,9 @@ class PrefBackedBooleanTest : public PlatformTest {
public:
void SetUp() override {
pref_service_.registry()->RegisterBooleanPref(kTestSwitchPref, false);
- observable_boolean_.reset([[PrefBackedBoolean alloc]
- initWithPrefService:&pref_service_
- prefName:kTestSwitchPref]);
+ observable_boolean_ =
+ [[PrefBackedBoolean alloc] initWithPrefService:&pref_service_
+ prefName:kTestSwitchPref];
}
protected:
@@ -34,13 +37,11 @@ class PrefBackedBooleanTest : public PlatformTest {
pref_service_.SetUserPref(kTestSwitchPref, booleanValue);
}
- PrefBackedBoolean* GetObservableBoolean() {
- return observable_boolean_.get();
- }
+ PrefBackedBoolean* GetObservableBoolean() { return observable_boolean_; }
web::TestWebThreadBundle thread_bundle_;
TestingPrefServiceSimple pref_service_;
- base::scoped_nsobject<PrefBackedBoolean> observable_boolean_;
+ PrefBackedBoolean* observable_boolean_;
};
TEST_F(PrefBackedBooleanTest, ReadFromPrefs) {
@@ -61,17 +62,15 @@ TEST_F(PrefBackedBooleanTest, WriteToPrefs) {
TEST_F(PrefBackedBooleanTest, ObserverUpdates) {
SetPref(false);
- base::scoped_nsobject<TestBooleanObserver> observer(
- [[TestBooleanObserver alloc] init]);
+ TestBooleanObserver* observer = [[TestBooleanObserver alloc] init];
GetObservableBoolean().observer = observer;
- EXPECT_EQ(0, observer.get().updateCount);
+ EXPECT_EQ(0, observer.updateCount);
SetPref(true);
- EXPECT_EQ(1, observer.get().updateCount)
- << "Changing value should update observer";
+ EXPECT_EQ(1, observer.updateCount) << "Changing value should update observer";
SetPref(true);
- EXPECT_EQ(1, observer.get().updateCount)
+ EXPECT_EQ(1, observer.updateCount)
<< "Setting the same value should not update observer";
}
« no previous file with comments | « ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698