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

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller_unittest.mm

Issue 2755823002: Moved |openedByDOM| to WebState's CreateParams and public interface. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
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
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
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 = 173 web::WebState::CreateParams params(chrome_browser_state_.get());
175 [OCMockObject niceMockForClass:[CRWSessionController class]]; 174 std::unique_ptr<web::WebState> webState = web::WebState::Create(params);
176 webStateImpl_.reset(new WebStateImpl(chrome_browser_state_.get())); 175 webStateImpl_.reset(static_cast<web::WebStateImpl*>(webState.release()));
177 [currentTab setWebState:webStateImpl_.get()]; 176 [currentTab setWebState:webStateImpl_.get()];
178 webStateImpl_->SetWebController(webControllerMock); 177 webStateImpl_->SetWebController(webControllerMock);
179 webStateImpl_->GetNavigationManagerImpl().SetSessionController(
180 sessionControllerMock);
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 static_cast<OCMockObject*>(shareController_.get()); 539 static_cast<OCMockObject*>(shareController_.get());
543 [[shareControllerMock expect] cancelShareAnimated:NO]; 540 [[shareControllerMock expect] cancelShareAnimated:NO];
544 EXPECT_CALL(*this, OnCompletionCalled()); 541 EXPECT_CALL(*this, OnCompletionCalled());
545 [bvc_ clearPresentedStateWithCompletion:^{ 542 [bvc_ clearPresentedStateWithCompletion:^{
546 this->OnCompletionCalled(); 543 this->OnCompletionCalled();
547 }]; 544 }];
548 EXPECT_OCMOCK_VERIFY(shareControllerMock); 545 EXPECT_OCMOCK_VERIFY(shareControllerMock);
549 } 546 }
550 547
551 } // namespace 548 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698