Commit 8ccae6f5 authored by sczs's avatar sczs Committed by Commit Bot

[ios clean] Removes SetWebUsageEnabled calls on web_contents_mediator

Bug: 
Change-Id: I0c2fcb72512efbc8a39b48a2d833075a034e127f
Reviewed-on: https://chromium-review.googlesource.com/567802Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486067}
parent ba20221f
......@@ -24,9 +24,6 @@ class WebState;
// object and may be nil.
@property(nonatomic, weak) id<WebContentsConsumer> consumer;
// Sets the active webState's webUsageEnabled to false.
- (void)disconnect;
@end
#endif // IOS_CLEAN_CHROME_BROWSER_UI_WEB_CONTENTS_WEB_CONTENTS_MEDIATOR_H_
......@@ -21,16 +21,9 @@
@synthesize webState = _webState;
@synthesize consumer = _consumer;
#pragma mark - Public
- (void)disconnect {
[self disableWebUsage:self.webState];
}
#pragma mark - Properties
- (void)setWebState:(web::WebState*)webState {
[self disableWebUsage:_webState];
_webState = webState;
[self updateConsumerWithWebState:webState];
}
......@@ -44,17 +37,10 @@
#pragma mark - Private
- (void)disableWebUsage:(web::WebState*)webState {
if (webState) {
webState->SetWebUsageEnabled(false);
}
}
// Sets |webState| webUsageEnabled and updates the consumer's contentView.
// Updates the consumer's contentView.
- (void)updateConsumerWithWebState:(web::WebState*)webState {
UIView* updatedView = nil;
if (webState) {
webState->SetWebUsageEnabled(true);
updatedView = webState->GetView();
// PLACEHOLDER: This navigates the page since the omnibox is not yet
// hooked up.
......
......@@ -45,7 +45,6 @@ class WebContentsMediatorTest : public PlatformTest {
mediator_ = [[WebContentsMediator alloc] init];
}
~WebContentsMediatorTest() override { [mediator_ disconnect]; }
TabNavigationManager* navigation_manager() {
return static_cast<TabNavigationManager*>(
......@@ -63,25 +62,6 @@ class WebContentsMediatorTest : public PlatformTest {
web::TestWebState new_test_web_state_;
};
// Tests that webUsage is disabled when mediator is disconnected.
TEST_F(WebContentsMediatorTest, TestDisconnect) {
mediator_.webState = &test_web_state_;
EXPECT_TRUE(test_web_state_.IsWebUsageEnabled());
[mediator_ disconnect];
EXPECT_FALSE(test_web_state_.IsWebUsageEnabled());
}
// Tests that both the old and new active web states have WebUsageEnabled
// updated.
TEST_F(WebContentsMediatorTest, TestWebUsageEnabled) {
mediator_.webState = &test_web_state_;
test_web_state_.SetWebUsageEnabled(true);
new_test_web_state_.SetWebUsageEnabled(false);
mediator_.webState = &new_test_web_state_;
EXPECT_FALSE(test_web_state_.IsWebUsageEnabled());
EXPECT_TRUE(new_test_web_state_.IsWebUsageEnabled());
}
// Tests that a URL is loaded if the new active web state has zero navigation
// items.
TEST_F(WebContentsMediatorTest, TestURLHasLoaded) {
......
......@@ -59,7 +59,6 @@
- (void)stop {
[super stop];
[self.mediator disconnect];
}
- (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment