Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ios/chrome/browser/signin/gaia_auth_fetcher_ios_unittest.mm

Issue 2935733002: [ObjC ARC] Converts ios/chrome/browser/signin:unit_tests to ARC. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/signin/chrome_identity_service_observer_bridge_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
10 #include "base/run_loop.h" 9 #include "base/run_loop.h"
11 #include "google_apis/gaia/gaia_urls.h" 10 #include "google_apis/gaia/gaia_urls.h"
12 #include "ios/chrome/browser/signin/gaia_auth_fetcher_ios_private.h" 11 #include "ios/chrome/browser/signin/gaia_auth_fetcher_ios_private.h"
13 #include "ios/web/public/test/fakes/test_browser_state.h" 12 #include "ios/web/public/test/fakes/test_browser_state.h"
14 #include "ios/web/public/test/test_web_thread_bundle.h" 13 #include "ios/web/public/test/test_web_thread_bundle.h"
15 #include "net/url_request/test_url_fetcher_factory.h" 14 #include "net/url_request/test_url_fetcher_factory.h"
16 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
18 #import "testing/gtest_mac.h" 17 #import "testing/gtest_mac.h"
19 #include "testing/platform_test.h" 18 #include "testing/platform_test.h"
20 #import "third_party/ocmock/OCMock/OCMock.h" 19 #import "third_party/ocmock/OCMock/OCMock.h"
21 #import "third_party/ocmock/gtest_support.h" 20 #import "third_party/ocmock/gtest_support.h"
22 21
22 #if !defined(__has_feature) || !__has_feature(objc_arc)
23 #error "This file requires ARC support."
24 #endif
25
23 namespace { 26 namespace {
24 27
25 class FakeGaiaAuthFetcherIOSBridge : public GaiaAuthFetcherIOSBridge { 28 class FakeGaiaAuthFetcherIOSBridge : public GaiaAuthFetcherIOSBridge {
26 public: 29 public:
27 FakeGaiaAuthFetcherIOSBridge(GaiaAuthFetcherIOS* fetcher, 30 FakeGaiaAuthFetcherIOSBridge(GaiaAuthFetcherIOS* fetcher,
28 web::BrowserState* browser_state) 31 web::BrowserState* browser_state)
29 : GaiaAuthFetcherIOSBridge(fetcher, browser_state), mock_web_view_(nil) {} 32 : GaiaAuthFetcherIOSBridge(fetcher, browser_state), mock_web_view_(nil) {}
30 33
31 private: 34 private:
32 WKWebView* BuildWKWebView() override { 35 WKWebView* BuildWKWebView() override {
33 if (!mock_web_view_) { 36 if (!mock_web_view_) {
34 mock_web_view_.reset( 37 mock_web_view_ = [OCMockObject niceMockForClass:[WKWebView class]];
35 [[OCMockObject niceMockForClass:[WKWebView class]] retain]);
36 } 38 }
37 return mock_web_view_; 39 return mock_web_view_;
38 } 40 }
39 base::scoped_nsobject<id> mock_web_view_; 41 id mock_web_view_;
40 }; 42 };
41 43
42 class MockGaiaConsumer : public GaiaAuthConsumer { 44 class MockGaiaConsumer : public GaiaAuthConsumer {
43 public: 45 public:
44 MockGaiaConsumer() {} 46 MockGaiaConsumer() {}
45 ~MockGaiaConsumer() {} 47 ~MockGaiaConsumer() {}
46 48
47 MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data)); 49 MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data));
48 MOCK_METHOD1(OnClientLoginFailure, void(const GoogleServiceAuthError& error)); 50 MOCK_METHOD1(OnClientLoginFailure, void(const GoogleServiceAuthError& error));
49 MOCK_METHOD1(OnLogOutFailure, void(const GoogleServiceAuthError& error)); 51 MOCK_METHOD1(OnLogOutFailure, void(const GoogleServiceAuthError& error));
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 [[GetMockWKWebView() expect] setNavigationDelegate:[OCMArg isNotNil]]; 186 [[GetMockWKWebView() expect] setNavigationDelegate:[OCMArg isNotNil]];
185 [static_cast<WKWebView*>([[GetMockWKWebView() expect] andDo:^(NSInvocation*) { 187 [static_cast<WKWebView*>([[GetMockWKWebView() expect] andDo:^(NSInvocation*) {
186 GetBridge()->URLFetchSuccess("data"); 188 GetBridge()->URLFetchSuccess("data");
187 }]) loadRequest:[OCMArg any]]; 189 }]) loadRequest:[OCMArg any]];
188 190
189 gaia_auth_fetcher_->StartMergeSession("uber_token", ""); 191 gaia_auth_fetcher_->StartMergeSession("uber_token", "");
190 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); 192 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false);
191 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); 193 web::BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true);
192 EXPECT_OCMOCK_VERIFY(GetMockWKWebView()); 194 EXPECT_OCMOCK_VERIFY(GetMockWKWebView());
193 } 195 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/signin/chrome_identity_service_observer_bridge_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698