| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_WEB_VIEW_TEST_OBSERVERS_OBSERVER_H_ |
| 6 #define IOS_WEB_VIEW_TEST_OBSERVERS_OBSERVER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 // A base class to observe a KVO compliant property. To use this Observer, first |
| 11 // create an instance of a specialized subclass (depending on the type of |
| 12 // |keyPath|) then call |setObservedObject:keyPath:|. You can use this class |
| 13 // directly by testing expected values against |lastRawValue|, but prefer to |
| 14 // create a subclass similar to BooleanObserver to minimize casting. |
| 15 @interface Observer : NSObject |
| 16 |
| 17 // The last value of performing |keyPath| on |object| after being notified of a |
| 18 // KVO value change or null if a change has not been observed. |
| 19 @property(nonatomic, nullable, readonly) id lastRawValue; |
| 20 |
| 21 // The |keyPath| of |object| being observed. |
| 22 @property(nonatomic, nullable, readonly) NSString* keyPath; |
| 23 |
| 24 // The current |object| being observed. |
| 25 @property(nonatomic, nullable, readonly, weak) NSObject* object; |
| 26 |
| 27 // Sets the |object| and |keyPath| to observe. Performing |keyPath| on |object| |
| 28 // must return a BOOL value and |keyPath| must be KVO compliant. |
| 29 - (void)setObservedObject:(nonnull NSObject*)object |
| 30 keyPath:(nonnull NSString*)keyPath; |
| 31 |
| 32 @end |
| 33 |
| 34 #endif // IOS_WEB_VIEW_TEST_OBSERVERS_OBSERVER_H_ |
| OLD | NEW |