| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web/test/crw_fake_web_controller_observer.h" | 5 #import "ios/web/test/crw_fake_web_controller_observer.h" |
| 6 | 6 |
| 7 #import "base/logging.h" | 7 @implementation CRWFakeWebControllerObserver |
| 8 #import "base/mac/scoped_nsobject.h" | |
| 9 #include "base/values.h" | |
| 10 | |
| 11 @implementation CRWFakeWebControllerObserver { | |
| 12 ScopedVector<base::DictionaryValue> _commandsReceived; | |
| 13 base::scoped_nsobject<NSString> _commandPrefix; | |
| 14 } | |
| 15 | 8 |
| 16 @synthesize pageLoaded = _pageLoaded; | 9 @synthesize pageLoaded = _pageLoaded; |
| 17 | 10 |
| 18 - (instancetype)initWithCommandPrefix:(NSString*)commandPrefix { | |
| 19 DCHECK(commandPrefix); | |
| 20 self = [super init]; | |
| 21 if (self) { | |
| 22 _commandPrefix.reset([commandPrefix copy]); | |
| 23 } | |
| 24 return self; | |
| 25 } | |
| 26 | |
| 27 - (instancetype)init { | |
| 28 NOTREACHED(); | |
| 29 return nil; | |
| 30 } | |
| 31 | |
| 32 - (void)pageLoaded:(CRWWebController*)webController { | 11 - (void)pageLoaded:(CRWWebController*)webController { |
| 33 _pageLoaded = YES; | 12 _pageLoaded = YES; |
| 34 } | 13 } |
| 35 | 14 |
| 36 - (NSString*)commandPrefix { | |
| 37 return _commandPrefix; | |
| 38 } | |
| 39 | |
| 40 - (BOOL)handleCommand:(const base::DictionaryValue&)command | |
| 41 webController:(CRWWebController*)webController | |
| 42 userIsInteracting:(BOOL)userIsInteracting | |
| 43 originURL:(const GURL&)originURL { | |
| 44 _commandsReceived.push_back(command.DeepCopy()); | |
| 45 return YES; | |
| 46 } | |
| 47 | |
| 48 - (ScopedVector<base::DictionaryValue>&)commandsReceived { | |
| 49 return _commandsReceived; | |
| 50 } | |
| 51 | |
| 52 @end | 15 @end |
| OLD | NEW |