Chromium Code Reviews| Index: ios/web_view/test/boolean_observer.h |
| diff --git a/ios/web_view/test/boolean_observer.h b/ios/web_view/test/boolean_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e0be86c445cbbdbb75a74a366df393fd3a39d1af |
| --- /dev/null |
| +++ b/ios/web_view/test/boolean_observer.h |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ |
| +#define IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ |
| + |
| +#import <Foundation/Foundation.h> |
| + |
| +// Class to observe a boolean KVO compliant property. |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Could you please explain in the comments how to us
michaeldo
2017/05/23 16:20:51
Done.
|
| +@interface BooleanObserver : NSObject |
| + |
| +// The last value of performing |keyPath| on |object| after being notified of a |
| +// KVO value change. NO if a change has not been observed. |
| +@property(nonatomic, readonly) BOOL lastValue; |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Should we implement more generic class that can ob
michaeldo
2017/05/23 16:20:51
Yes, but I will do this in a followup CL as part o
|
| + |
| +// The |keyPath| of |object| being observed. |
| +@property(nonatomic, readonly) NSString* keyPath; |
| + |
| +// The current |object| being observed. |
| +@property(nonatomic, readonly, weak) NSObject* object; |
| + |
| +// Sets the |object| and |keyPath| to observe. Performing |keyPath| on |object| |
| +// must return a BOOL value and |keyPath| must be KVO compliant. |
| +- (void)setObservedObject:(NSObject*)object keyPath:(NSString*)keyPath; |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Do you want to use nullability annotation and expl
michaeldo
2017/05/23 16:20:51
Added. PTAL. I think |keyPath| can be null if obje
|
| + |
| +@end |
| + |
| +#endif // IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ |