| 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 #include "ios/web/public/test/scoped_testing_web_client.h" | 5 #include "ios/web/public/test/scoped_testing_web_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ios/web/public/web_client.h" | 8 #import "ios/web/public/web_client.h" |
| 9 | 9 |
| 10 namespace web { | 10 namespace web { |
| 11 | 11 |
| 12 ScopedTestingWebClient::ScopedTestingWebClient( | 12 ScopedTestingWebClient::ScopedTestingWebClient( |
| 13 std::unique_ptr<WebClient> web_client) | 13 std::unique_ptr<WebClient> web_client) |
| 14 : web_client_(std::move(web_client)), original_web_client_(GetWebClient()) { | 14 : web_client_(std::move(web_client)), original_web_client_(GetWebClient()) { |
| 15 SetWebClient(web_client_.get()); | 15 SetWebClient(web_client_.get()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 ScopedTestingWebClient::~ScopedTestingWebClient() { | 18 ScopedTestingWebClient::~ScopedTestingWebClient() { |
| 19 DCHECK_EQ(GetWebClient(), web_client_.get()); | 19 DCHECK_EQ(GetWebClient(), web_client_.get()); |
| 20 SetWebClient(original_web_client_); | 20 SetWebClient(original_web_client_); |
| 21 } | 21 } |
| 22 | 22 |
| 23 WebClient* ScopedTestingWebClient::Get() { | 23 WebClient* ScopedTestingWebClient::Get() { |
| 24 return web_client_.get(); | 24 return web_client_.get(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace web | 27 } // namespace web |
| OLD | NEW |