| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/utils/fake_observable_boolean.h" | 5 #import "ios/chrome/browser/ui/settings/utils/fake_observable_boolean.h" |
| 6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." |
| 9 #endif |
| 10 |
| 7 @implementation FakeObservableBoolean | 11 @implementation FakeObservableBoolean |
| 8 | 12 |
| 9 @synthesize value = _value; | 13 @synthesize value = _value; |
| 10 @synthesize observer = _observer; | 14 @synthesize observer = _observer; |
| 11 | 15 |
| 12 - (void)setValue:(BOOL)value { | 16 - (void)setValue:(BOOL)value { |
| 13 bool changed = value != _value; | 17 bool changed = value != _value; |
| 14 _value = value; | 18 _value = value; |
| 15 if (changed) | 19 if (changed) |
| 16 [self.observer booleanDidChange:self]; | 20 [self.observer booleanDidChange:self]; |
| 17 } | 21 } |
| 18 | 22 |
| 19 @end | 23 @end |
| 20 | 24 |
| 21 @implementation TestBooleanObserver | 25 @implementation TestBooleanObserver |
| 22 | 26 |
| 23 @synthesize updateCount = _updateCount; | 27 @synthesize updateCount = _updateCount; |
| 24 | 28 |
| 25 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { | 29 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { |
| 26 self.updateCount++; | 30 self.updateCount++; |
| 27 } | 31 } |
| 28 | 32 |
| 29 @end | 33 @end |
| OLD | NEW |