| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 #import <PassKit/PassKit.h> | 6 #import <PassKit/PassKit.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h" | 42 #include "ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h" |
| 43 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" | 43 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
| 44 #include "ios/chrome/browser/ui/ui_util.h" | 44 #include "ios/chrome/browser/ui/ui_util.h" |
| 45 #import "ios/chrome/browser/web/error_page_content.h" | 45 #import "ios/chrome/browser/web/error_page_content.h" |
| 46 #import "ios/chrome/browser/web/passkit_dialog_provider.h" | 46 #import "ios/chrome/browser/web/passkit_dialog_provider.h" |
| 47 #include "ios/chrome/grit/ios_strings.h" | 47 #include "ios/chrome/grit/ios_strings.h" |
| 48 #include "ios/chrome/test/block_cleanup_test.h" | 48 #include "ios/chrome/test/block_cleanup_test.h" |
| 49 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" | 49 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" |
| 50 #include "ios/chrome/test/testing_application_context.h" | 50 #include "ios/chrome/test/testing_application_context.h" |
| 51 #import "ios/testing/ocmock_complex_type_helper.h" | 51 #import "ios/testing/ocmock_complex_type_helper.h" |
| 52 #import "ios/web/navigation/crw_session_controller.h" | |
| 53 #include "ios/web/public/referrer.h" | 52 #include "ios/web/public/referrer.h" |
| 54 #include "ios/web/public/test/test_web_thread_bundle.h" | 53 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 55 #import "ios/web/public/web_state/ui/crw_native_content_provider.h" | 54 #import "ios/web/public/web_state/ui/crw_native_content_provider.h" |
| 56 #import "ios/web/web_state/ui/crw_web_controller.h" | 55 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 57 #import "ios/web/web_state/web_state_impl.h" | 56 #import "ios/web/web_state/web_state_impl.h" |
| 58 #import "net/base/mac/url_conversions.h" | 57 #import "net/base/mac/url_conversions.h" |
| 59 #include "net/url_request/url_request_test_util.h" | 58 #include "net/url_request/url_request_test_util.h" |
| 60 #include "testing/gmock/include/gmock/gmock.h" | 59 #include "testing/gmock/include/gmock/gmock.h" |
| 61 #include "testing/gtest/include/gtest/gtest.h" | 60 #include "testing/gtest/include/gtest/gtest.h" |
| 62 #include "testing/gtest_mac.h" | 61 #include "testing/gtest_mac.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 [[tabModel stub] removeObserver:[OCMArg any]]; | 163 [[tabModel stub] removeObserver:[OCMArg any]]; |
| 165 [[tabModel stub] saveSessionImmediately:NO]; | 164 [[tabModel stub] saveSessionImmediately:NO]; |
| 166 [[tabModel stub] setCurrentTab:[OCMArg any]]; | 165 [[tabModel stub] setCurrentTab:[OCMArg any]]; |
| 167 [[tabModel stub] closeAllTabs]; | 166 [[tabModel stub] closeAllTabs]; |
| 168 | 167 |
| 169 // Stub methods for Tab. | 168 // Stub methods for Tab. |
| 170 UIView* dummyView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; | 169 UIView* dummyView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; |
| 171 [[[currentTab stub] andReturn:dummyView] view]; | 170 [[[currentTab stub] andReturn:dummyView] view]; |
| 172 [[[currentTab stub] andReturn:webControllerMock] webController]; | 171 [[[currentTab stub] andReturn:webControllerMock] webController]; |
| 173 | 172 |
| 174 id sessionControllerMock = | |
| 175 [OCMockObject niceMockForClass:[CRWSessionController class]]; | |
| 176 webStateImpl_.reset(new WebStateImpl(chrome_browser_state_.get())); | 173 webStateImpl_.reset(new WebStateImpl(chrome_browser_state_.get())); |
| 177 [currentTab setWebState:webStateImpl_.get()]; | 174 [currentTab setWebState:webStateImpl_.get()]; |
| 178 webStateImpl_->SetWebController(webControllerMock); | 175 webStateImpl_->SetWebController(webControllerMock); |
| 179 webStateImpl_->GetNavigationManagerImpl().SetSessionController( | 176 webStateImpl_->GetNavigationManagerImpl().InitializeSession( |
| 180 sessionControllerMock); | 177 NO /*opened_by_dom*/); |
| 181 | 178 |
| 182 // Set up mock ShareController. | 179 // Set up mock ShareController. |
| 183 id shareController = | 180 id shareController = |
| 184 [OCMockObject niceMockForProtocol:@protocol(ShareProtocol)]; | 181 [OCMockObject niceMockForProtocol:@protocol(ShareProtocol)]; |
| 185 shareController_.reset([shareController retain]); | 182 shareController_.reset([shareController retain]); |
| 186 | 183 |
| 187 id passKitController = | 184 id passKitController = |
| 188 [OCMockObject niceMockForClass:[PKAddPassesViewController class]]; | 185 [OCMockObject niceMockForClass:[PKAddPassesViewController class]]; |
| 189 passKitViewController_.reset([passKitController retain]); | 186 passKitViewController_.reset([passKitController retain]); |
| 190 | 187 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 static_cast<OCMockObject*>(shareController_.get()); | 538 static_cast<OCMockObject*>(shareController_.get()); |
| 542 [[shareControllerMock expect] cancelShareAnimated:NO]; | 539 [[shareControllerMock expect] cancelShareAnimated:NO]; |
| 543 EXPECT_CALL(*this, OnCompletionCalled()); | 540 EXPECT_CALL(*this, OnCompletionCalled()); |
| 544 [bvc_ clearPresentedStateWithCompletion:^{ | 541 [bvc_ clearPresentedStateWithCompletion:^{ |
| 545 this->OnCompletionCalled(); | 542 this->OnCompletionCalled(); |
| 546 }]; | 543 }]; |
| 547 EXPECT_OCMOCK_VERIFY(shareControllerMock); | 544 EXPECT_OCMOCK_VERIFY(shareControllerMock); |
| 548 } | 545 } |
| 549 | 546 |
| 550 } // namespace | 547 } // namespace |
| OLD | NEW |