| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 #import "ios/web/public/test/test_native_content_provider.h" | |
| 6 | |
| 7 #include <map> | |
| 8 | |
| 9 #include "url/gurl.h" | |
| 10 | |
| 11 @implementation TestNativeContentProvider { | |
| 12 std::map<GURL, id<CRWNativeContent>> _nativeContent; | |
| 13 } | |
| 14 | |
| 15 - (void)setController:(id<CRWNativeContent>)controller forURL:(const GURL&)URL { | |
| 16 _nativeContent[URL] = controller; | |
| 17 } | |
| 18 | |
| 19 - (BOOL)hasControllerForURL:(const GURL&)URL { | |
| 20 return _nativeContent.find(URL) != _nativeContent.end(); | |
| 21 } | |
| 22 | |
| 23 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL { | |
| 24 auto nativeContent = _nativeContent.find(URL); | |
| 25 if (nativeContent == _nativeContent.end()) { | |
| 26 return nil; | |
| 27 } | |
| 28 return nativeContent->second; | |
| 29 } | |
| 30 | |
| 31 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL | |
| 32 withError:(NSError*)error | |
| 33 isPost:(BOOL)isPost { | |
| 34 NOTREACHED(); | |
| 35 return nil; | |
| 36 } | |
| 37 | |
| 38 @end | |
| OLD | NEW |