| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app/application_delegate/url_opener.h" | 5 #include "ios/chrome/app/application_delegate/url_opener.h" | 
| 6 | 6 | 
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> | 
| 8 | 8 | 
| 9 #include "ios/chrome/app/application_delegate/app_state.h" | 9 #include "ios/chrome/app/application_delegate/app_state.h" | 
| 10 #include "ios/chrome/app/application_delegate/app_state_testing.h" | 10 #include "ios/chrome/app/application_delegate/app_state_testing.h" | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70 @property(nonatomic, assign) GURL tabURL; | 70 @property(nonatomic, assign) GURL tabURL; | 
| 71 @property(nonatomic, assign) NSUInteger position; | 71 @property(nonatomic, assign) NSUInteger position; | 
| 72 @property(nonatomic, assign) ui::PageTransition transition; | 72 @property(nonatomic, assign) ui::PageTransition transition; | 
| 73 | 73 | 
| 74 - (Tab*)addSelectedTabWithURL:(const GURL&)url | 74 - (Tab*)addSelectedTabWithURL:(const GURL&)url | 
| 75                       atIndex:(NSUInteger)position | 75                       atIndex:(NSUInteger)position | 
| 76                    transition:(ui::PageTransition)transition; | 76                    transition:(ui::PageTransition)transition; | 
| 77 - (void)expectNewForegroundTab; | 77 - (void)expectNewForegroundTab; | 
| 78 - (void)setActive:(BOOL)active; | 78 - (void)setActive:(BOOL)active; | 
| 79 - (TabModel*)tabModel; | 79 - (TabModel*)tabModel; | 
| 80 - (void)shutdown; |  | 
| 81 @end | 80 @end | 
| 82 | 81 | 
| 83 @implementation URLOpenerMockBVC | 82 @implementation URLOpenerMockBVC | 
| 84 @synthesize browserState = _browserState; | 83 @synthesize browserState = _browserState; | 
| 85 @synthesize tabURL = _tabURL; | 84 @synthesize tabURL = _tabURL; | 
| 86 @synthesize position = _position; | 85 @synthesize position = _position; | 
| 87 @synthesize transition = _transition; | 86 @synthesize transition = _transition; | 
| 88 | 87 | 
| 89 - (Tab*)addSelectedTabWithURL:(const GURL&)url | 88 - (Tab*)addSelectedTabWithURL:(const GURL&)url | 
| 90                       atIndex:(NSUInteger)position | 89                       atIndex:(NSUInteger)position | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 104 } | 103 } | 
| 105 | 104 | 
| 106 - (void)setPrimary:(BOOL)primary { | 105 - (void)setPrimary:(BOOL)primary { | 
| 107   // no-op | 106   // no-op | 
| 108 } | 107 } | 
| 109 | 108 | 
| 110 - (TabModel*)tabModel { | 109 - (TabModel*)tabModel { | 
| 111   return nil; | 110   return nil; | 
| 112 } | 111 } | 
| 113 | 112 | 
| 114 - (void)shutdown { |  | 
| 115   // no-op |  | 
| 116 } |  | 
| 117 |  | 
| 118 @end | 113 @end | 
| 119 | 114 | 
| 120 class URLOpenerTest : public PlatformTest { | 115 class URLOpenerTest : public PlatformTest { | 
| 121  protected: | 116  protected: | 
| 122   void TearDown() override { |  | 
| 123     [main_controller_ stopChromeMain]; |  | 
| 124     PlatformTest::TearDown(); |  | 
| 125   } |  | 
| 126 |  | 
| 127   MainController* GetMainController() { | 117   MainController* GetMainController() { | 
| 128     if (!main_controller_) { | 118     if (!main_controller_) { | 
| 129       main_controller_ = [[MainController alloc] init]; | 119       main_controller_ = [[MainController alloc] init]; | 
| 130       [main_controller_ setUpAsForegrounded]; | 120       [main_controller_ setUpAsForegrounded]; | 
| 131       id mainTabModel = [OCMockObject mockForClass:[TabModel class]]; | 121       id mainTabModel = [OCMockObject mockForClass:[TabModel class]]; | 
| 132       [[mainTabModel stub] resetSessionMetrics]; | 122       [[mainTabModel stub] resetSessionMetrics]; | 
| 133       [[mainTabModel stub] browserStateDestroyed]; | 123       [[mainTabModel stub] browserStateDestroyed]; | 
| 134       [[mainTabModel stub] addObserver:[OCMArg any]]; | 124       [[mainTabModel stub] addObserver:[OCMArg any]]; | 
| 135       [[mainTabModel stub] removeObserver:[OCMArg any]]; | 125       [[mainTabModel stub] removeObserver:[OCMArg any]]; | 
| 136       [[main_controller_ browserViewInformation] setMainTabModel:mainTabModel]; | 126       [[main_controller_ browserViewInformation] setMainTabModel:mainTabModel]; | 
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 484   [URLOpener handleLaunchOptions:launchOptions | 474   [URLOpener handleLaunchOptions:launchOptions | 
| 485                applicationActive:NO | 475                applicationActive:NO | 
| 486                        tabOpener:tabOpenerMock | 476                        tabOpener:tabOpenerMock | 
| 487               startupInformation:startupInformationMock | 477               startupInformation:startupInformationMock | 
| 488                         appState:appStateMock]; | 478                         appState:appStateMock]; | 
| 489 | 479 | 
| 490   // Test. | 480   // Test. | 
| 491   EXPECT_TRUE(hasBeenCalled); | 481   EXPECT_TRUE(hasBeenCalled); | 
| 492   EXPECT_OCMOCK_VERIFY(startupInformationMock); | 482   EXPECT_OCMOCK_VERIFY(startupInformationMock); | 
| 493 } | 483 } | 
| OLD | NEW | 
|---|