| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 EXPECT_OCMOCK_VERIFY(tabMock); | 399 EXPECT_OCMOCK_VERIFY(tabMock); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // Verifies that BVC invokes -shareURL on ShareController with the correct | 402 // Verifies that BVC invokes -shareURL on ShareController with the correct |
| 403 // parameters in response to the IDC_SHARE_PAGE command. | 403 // parameters in response to the IDC_SHARE_PAGE command. |
| 404 TEST_F(BrowserViewControllerTest, TestSharePageCommandHandling) { | 404 TEST_F(BrowserViewControllerTest, TestSharePageCommandHandling) { |
| 405 GURL expectedUrl("http://www.testurl.net"); | 405 GURL expectedUrl("http://www.testurl.net"); |
| 406 NSString* expectedTitle = @"title"; | 406 NSString* expectedTitle = @"title"; |
| 407 [(BVCTestTabMock*)tab_.get() setUrl:expectedUrl]; | 407 [(BVCTestTabMock*)tab_.get() setUrl:expectedUrl]; |
| 408 OCMockObject* tabMock = (OCMockObject*)tab_.get(); | 408 OCMockObject* tabMock = (OCMockObject*)tab_.get(); |
| 409 ios::ChromeBrowserState* ptr = chrome_browser_state_.get(); |
| 410 [[[tabMock stub] andReturnValue:OCMOCK_VALUE(ptr)] browserState]; |
| 409 [[[tabMock stub] andReturn:expectedTitle] title]; | 411 [[[tabMock stub] andReturn:expectedTitle] title]; |
| 410 [[[tabMock stub] andReturn:expectedTitle] originalTitle]; | 412 [[[tabMock stub] andReturn:expectedTitle] originalTitle]; |
| 413 |
| 411 base::scoped_nsobject<ShareToData> expectedShareData([[ShareToData alloc] | 414 base::scoped_nsobject<ShareToData> expectedShareData([[ShareToData alloc] |
| 412 initWithURL:expectedUrl | 415 initWithURL:expectedUrl |
| 413 title:expectedTitle | 416 title:expectedTitle |
| 414 isOriginalTitle:YES | 417 isOriginalTitle:YES |
| 415 isPagePrintable:YES]); | 418 isPagePrintable:NO |
| 419 thumbnailGenerator:^UIImage*(CGSize const&) { |
| 420 return nil; |
| 421 }]); |
| 416 OCMockObject* shareControllerMock = (OCMockObject*)shareController_.get(); | 422 OCMockObject* shareControllerMock = (OCMockObject*)shareController_.get(); |
| 417 // Passing non zero/nil |fromRect| and |inView| parameters to satisfy protocol | 423 // Passing non zero/nil |fromRect| and |inView| parameters to satisfy protocol |
| 418 // requirements. | 424 // requirements. |
| 419 [[shareControllerMock expect] | 425 [[shareControllerMock expect] |
| 420 shareWithData:expectedShareData | 426 shareWithData:expectedShareData |
| 421 controller:bvc_ | 427 controller:bvc_ |
| 422 browserState:chrome_browser_state_.get() | 428 browserState:chrome_browser_state_.get() |
| 423 shareToDelegate:bvc_ | 429 shareToDelegate:bvc_ |
| 424 fromRect:[bvc_ testing_shareButtonAnchorRect] | 430 fromRect:[bvc_ testing_shareButtonAnchorRect] |
| 425 inView:[OCMArg any]]; | 431 inView:[OCMArg any]]; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 OCMockObject* shareControllerMock = (OCMockObject*)shareController_.get(); | 531 OCMockObject* shareControllerMock = (OCMockObject*)shareController_.get(); |
| 526 [[shareControllerMock expect] cancelShareAnimated:NO]; | 532 [[shareControllerMock expect] cancelShareAnimated:NO]; |
| 527 EXPECT_CALL(*this, OnCompletionCalled()); | 533 EXPECT_CALL(*this, OnCompletionCalled()); |
| 528 [bvc_ clearPresentedStateWithCompletion:^{ | 534 [bvc_ clearPresentedStateWithCompletion:^{ |
| 529 this->OnCompletionCalled(); | 535 this->OnCompletionCalled(); |
| 530 }]; | 536 }]; |
| 531 EXPECT_OCMOCK_VERIFY(shareControllerMock); | 537 EXPECT_OCMOCK_VERIFY(shareControllerMock); |
| 532 } | 538 } |
| 533 | 539 |
| 534 } // namespace | 540 } // namespace |
| OLD | NEW |