Commit e540a3fd authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

Don't display loading status for NTP.

Now that the NTP can load asynchronously, don't show the
network indicator, or the progress bar, when loading an
NTP.

Bug: 920669
Change-Id: I6e49e10716da50c529b609f0972b74bb67135daf
Reviewed-on: https://chromium-review.googlesource.com/c/1471236
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633841}
parent f4739065
......@@ -53,6 +53,7 @@ source_set("tabs") {
"//ios/chrome/browser/ui/favicon/resources:default_favicon_incognito",
"//ios/chrome/browser/ui/fullscreen",
"//ios/chrome/browser/ui/image_util",
"//ios/chrome/browser/ui/ntp:util",
"//ios/chrome/browser/ui/popup_menu/public",
"//ios/chrome/browser/ui/tab_grid/grid/resources:grid_cell_close_button",
"//ios/chrome/browser/ui/tabs/requirements",
......
......@@ -33,6 +33,7 @@
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#include "ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h"
#include "ios/chrome/browser/ui/fullscreen/scoped_fullscreen_disabler.h"
#import "ios/chrome/browser/ui/ntp/ntp_util.h"
#import "ios/chrome/browser/ui/popup_menu/public/popup_menu_long_press_delegate.h"
#import "ios/chrome/browser/ui/tabs/requirements/tab_strip_constants.h"
#import "ios/chrome/browser/ui/tabs/requirements/tab_strip_presentation.h"
......@@ -1050,7 +1051,7 @@ UIColor* BackgroundColor() {
[view setFavicon:favicon.ToUIImage()];
}
if (tab.webState->IsLoading())
if (tab.webState->IsLoading() && !IsVisibleURLNewTabPage(tab.webState))
[view startProgressSpinner];
else
[view stopProgressSpinner];
......
......@@ -121,6 +121,7 @@ source_set("unit_tests") {
"//components/bookmarks/browser",
"//components/bookmarks/test",
"//components/search_engines",
"//ios/chrome/browser",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/search_engines",
......
......@@ -267,8 +267,11 @@
DCHECK(self.consumer);
[self updateConsumerForWebState:self.webState];
[self.consumer setIsNTP:IsVisibleURLNewTabPage(self.webState)];
[self.consumer setLoadingState:self.webState->IsLoading()];
BOOL isNTP = IsVisibleURLNewTabPage(self.webState);
[self.consumer setIsNTP:isNTP];
// Never show the loading UI for an NTP.
BOOL isLoading = self.webState->IsLoading() && !isNTP;
[self.consumer setLoadingState:isLoading];
[self updateBookmarksForWebState:self.webState];
[self updateShareMenuForWebState:self.webState];
}
......
......@@ -13,6 +13,7 @@
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_navigation_manager.h"
#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_web_state.h"
#import "ios/chrome/browser/ui/toolbar/toolbar_consumer.h"
......@@ -394,6 +395,19 @@ TEST_F(ToolbarMediatorTest, TestDidStopLoading) {
[[consumer_ verify] setLoadingState:NO];
}
// Tests the Toolbar is not updated when the Webstate observer method
// DidStartLoading is triggered by SetLoading on the NTP.
TEST_F(ToolbarMediatorTest, TestDidStartLoadingNTP) {
mediator_.webStateList = web_state_list_.get();
SetUpActiveWebState();
mediator_.consumer = consumer_;
web_state_->SetLoading(false);
web_state_->SetVisibleURL(GURL(kChromeUINewTabURL));
web_state_->SetLoading(true);
[[consumer_ verify] setLoadingState:NO];
}
// Tests the Toolbar is updated when the Webstate observer method
// DidLoadPageWithSuccess is triggered by OnPageLoaded.
TEST_F(ToolbarMediatorTest, TestDidLoadPageWithSucess) {
......
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