| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ | 6 #define IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | 11 |
| 11 namespace web { | 12 namespace web { |
| 12 | 13 |
| 13 class WebClient; | 14 class WebClient; |
| 14 | 15 |
| 15 // Helper class to register a WebClient during unit testing. | 16 // Helper class to register a WebClient during unit testing. |
| 16 class ScopedTestingWebClient { | 17 class ScopedTestingWebClient { |
| 17 public: | 18 public: |
| 18 explicit ScopedTestingWebClient(scoped_ptr<WebClient> web_client); | 19 explicit ScopedTestingWebClient(std::unique_ptr<WebClient> web_client); |
| 19 ~ScopedTestingWebClient(); | 20 ~ScopedTestingWebClient(); |
| 20 | 21 |
| 21 WebClient* Get(); | 22 WebClient* Get(); |
| 22 | 23 |
| 23 private: | 24 private: |
| 24 scoped_ptr<WebClient> web_client_; | 25 std::unique_ptr<WebClient> web_client_; |
| 25 WebClient* original_web_client_; | 26 WebClient* original_web_client_; |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 } // namespace web | 29 } // namespace web |
| 29 | 30 |
| 30 #endif // IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ | 31 #endif // IOS_WEB_PUBLIC_TEST_SCOPED_TESTING_WEB_CLIENT_H_ |
| OLD | NEW |