[Sync] Improve test to use content resolver
[chromium-blink-merge.git] / ios / web / test / crw_fake_web_controller_observer.mm
blob18081684eb8cb6b587dc4349311a498a991a773e
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
3 // found in the LICENSE file.
5 #import "ios/web/test/crw_fake_web_controller_observer.h"
7 #import "base/logging.h"
8 #import "base/mac/scoped_nsobject.h"
9 #include "base/values.h"
11 @implementation CRWFakeWebControllerObserver {
12   ScopedVector<base::DictionaryValue> _commandsReceived;
13   base::scoped_nsobject<NSString> _commandPrefix;
16 @synthesize pageLoaded = _pageLoaded;
18 - (instancetype)init {
19   NOTREACHED();
20   return nil;
23 - (instancetype)initWithCommandPrefix:(NSString*)commandPrefix {
24   DCHECK(commandPrefix);
25   self = [super init];
26   if (self) {
27     _commandPrefix.reset([commandPrefix copy]);
28   }
29   return self;
32 - (void)pageLoaded:(CRWWebController*)webController {
33   _pageLoaded = YES;
36 - (NSString*)commandPrefix {
37   return _commandPrefix;
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;
48 - (ScopedVector<base::DictionaryValue>&)commandsReceived {
49   return _commandsReceived;
52 @end