| Index: ios/web_view/test/observers/observer.h
|
| diff --git a/ios/web_view/test/observers/observer.h b/ios/web_view/test/observers/observer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e42dea9906b4cb2cbd25a7790da7080475d87715
|
| --- /dev/null
|
| +++ b/ios/web_view/test/observers/observer.h
|
| @@ -0,0 +1,34 @@
|
| +// 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_OBSERVERS_OBSERVER_H_
|
| +#define IOS_WEB_VIEW_TEST_OBSERVERS_OBSERVER_H_
|
| +
|
| +#import <Foundation/Foundation.h>
|
| +
|
| +// A base class to observe a KVO compliant property. To use this Observer, first
|
| +// create an instance of a specialized subclass (depending on the type of
|
| +// |keyPath|) then call |setObservedObject:keyPath:|. You can use this class
|
| +// directly by testing expected values against |lastRawValue|, but prefer to
|
| +// create a subclass similar to BooleanObserver to minimize casting.
|
| +@interface Observer : NSObject
|
| +
|
| +// The last value of performing |keyPath| on |object| after being notified of a
|
| +// KVO value change or null if a change has not been observed.
|
| +@property(nonatomic, nullable, readonly) id lastRawValue;
|
| +
|
| +// The |keyPath| of |object| being observed.
|
| +@property(nonatomic, nullable, readonly) NSString* keyPath;
|
| +
|
| +// The current |object| being observed.
|
| +@property(nonatomic, nullable, 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:(nonnull NSObject*)object
|
| + keyPath:(nonnull NSString*)keyPath;
|
| +
|
| +@end
|
| +
|
| +#endif // IOS_WEB_VIEW_TEST_OBSERVERS_OBSERVER_H_
|
|
|