| 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/chrome/browser/signin/gaia_auth_fetcher_ios.h" | 5 #include "ios/chrome/browser/signin/gaia_auth_fetcher_ios.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 : GaiaAuthFetcherIOSBridge(fetcher, browser_state), mock_web_view_(nil) {} | 29 : GaiaAuthFetcherIOSBridge(fetcher, browser_state), mock_web_view_(nil) {} |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 WKWebView* BuildWKWebView() override { | 32 WKWebView* BuildWKWebView() override { |
| 33 if (!mock_web_view_) { | 33 if (!mock_web_view_) { |
| 34 mock_web_view_.reset( | 34 mock_web_view_.reset( |
| 35 [[OCMockObject niceMockForClass:[WKWebView class]] retain]); | 35 [[OCMockObject niceMockForClass:[WKWebView class]] retain]); |
| 36 } | 36 } |
| 37 return mock_web_view_; | 37 return mock_web_view_; |
| 38 } | 38 } |
| 39 scoped_nsobject<id> mock_web_view_; | 39 base::scoped_nsobject<id> mock_web_view_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class MockGaiaConsumer : public GaiaAuthConsumer { | 42 class MockGaiaConsumer : public GaiaAuthConsumer { |
| 43 public: | 43 public: |
| 44 MockGaiaConsumer() {} | 44 MockGaiaConsumer() {} |
| 45 ~MockGaiaConsumer() {} | 45 ~MockGaiaConsumer() {} |
| 46 | 46 |
| 47 MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data)); | 47 MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data)); |
| 48 MOCK_METHOD1(OnClientLoginFailure, void(const GoogleServiceAuthError& error)); | 48 MOCK_METHOD1(OnClientLoginFailure, void(const GoogleServiceAuthError& error)); |
| 49 MOCK_METHOD1(OnLogOutFailure, void(const GoogleServiceAuthError& error)); | 49 MOCK_METHOD1(OnLogOutFailure, void(const GoogleServiceAuthError& error)); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 [[GetMockWKWebView() expect] setNavigationDelegate:[OCMArg isNotNil]]; | 184 [[GetMockWKWebView() expect] setNavigationDelegate:[OCMArg isNotNil]]; |
| 185 [static_cast<WKWebView*>([[GetMockWKWebView() expect] andDo:^(NSInvocation*) { | 185 [static_cast<WKWebView*>([[GetMockWKWebView() expect] andDo:^(NSInvocation*) { |
| 186 GetBridge()->URLFetchSuccess("data"); | 186 GetBridge()->URLFetchSuccess("data"); |
| 187 }]) loadRequest:[OCMArg any]]; | 187 }]) loadRequest:[OCMArg any]]; |
| 188 | 188 |
| 189 gaia_auth_fetcher_->StartMergeSession("uber_token", ""); | 189 gaia_auth_fetcher_->StartMergeSession("uber_token", ""); |
| 190 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); | 190 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); |
| 191 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); | 191 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); |
| 192 EXPECT_OCMOCK_VERIFY(GetMockWKWebView()); | 192 EXPECT_OCMOCK_VERIFY(GetMockWKWebView()); |
| 193 } | 193 } |
| OLD | NEW |