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

Side by Side Diff: content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc

Issue 575203002: Use entry URLs instead of entry IDs to determine when to dismiss the overscroll overlay. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Check entry's URL in DoesEntryMatchURL for the sake of uni tests. Also fixing a nit. Created 6 years, 3 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
« no previous file with comments | « content/browser/web_contents/aura/overscroll_navigation_overlay.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/web_contents/aura/overscroll_navigation_overlay.h" 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h"
6 6
7 #include "content/browser/frame_host/navigation_entry_impl.h" 7 #include "content/browser/frame_host/navigation_entry_impl.h"
8 #include "content/browser/web_contents/aura/image_window_delegate.h" 8 #include "content/browser/web_contents/aura/image_window_delegate.h"
9 #include "content/browser/web_contents/web_contents_view.h" 9 #include "content/browser/web_contents/web_contents_view.h"
10 #include "content/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_PaintUpdate) { 150 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_PaintUpdate) {
151 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 151 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot());
152 SetDummyScreenshotOnNavEntry(controller().GetEntryAtOffset(-1)); 152 SetDummyScreenshotOnNavEntry(controller().GetEntryAtOffset(-1));
153 153
154 PerformBackNavigationViaSliderCallbacks(); 154 PerformBackNavigationViaSliderCallbacks();
155 // Screenshot was set on NavEntry at offset -1. 155 // Screenshot was set on NavEntry at offset -1.
156 EXPECT_TRUE(GetOverlay()->image_delegate_->has_image()); 156 EXPECT_TRUE(GetOverlay()->image_delegate_->has_image());
157 EXPECT_FALSE(GetOverlay()->received_paint_update_); 157 EXPECT_FALSE(GetOverlay()->received_paint_update_);
158 158
159 ReceivePaintUpdate(); 159 ReceivePaintUpdate();
160 // Paint updates until the navigation is committed represent updates 160 // Paint updates until the navigation is committed typically represent updates
161 // for the previous page, so they shouldn't affect the flag. 161 // for the previous page, so they shouldn't affect the flag.
162 EXPECT_FALSE(GetOverlay()->received_paint_update_); 162 EXPECT_FALSE(GetOverlay()->received_paint_update_);
163 163
164 contents()->CommitPendingNavigation(); 164 contents()->CommitPendingNavigation();
165 ReceivePaintUpdate(); 165 ReceivePaintUpdate();
166 // Navigation was committed and the paint update was received - the flag 166 // Navigation was committed and the paint update was received - the flag
167 // should now be updated. 167 // should now be updated.
168 EXPECT_TRUE(GetOverlay()->received_paint_update_); 168 EXPECT_TRUE(GetOverlay()->received_paint_update_);
169 169
170 EXPECT_FALSE(GetOverlay()->web_contents()); 170 EXPECT_FALSE(GetOverlay()->web_contents());
171 } 171 }
172 172
173 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_LoadingUpdate) { 173 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_LoadingUpdate) {
174 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 174 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot());
175 175
176 PerformBackNavigationViaSliderCallbacks(); 176 PerformBackNavigationViaSliderCallbacks();
177 // No screenshot was set on NavEntry at offset -1. 177 // No screenshot was set on NavEntry at offset -1.
178 EXPECT_FALSE(GetOverlay()->image_delegate_->has_image()); 178 EXPECT_FALSE(GetOverlay()->image_delegate_->has_image());
179 // Navigation was started, so the loading status flag should be reset. 179 // Navigation was started, so the loading status flag should be reset.
180 EXPECT_FALSE(GetOverlay()->loading_complete_); 180 EXPECT_FALSE(GetOverlay()->loading_complete_);
181 181
182 // Load updates until the navigation is committed represent updates for the 182 // DidStopLoading for any navigation should always reset the load flag and
183 // previous page, so they shouldn't affect the flag. 183 // dismiss the overlay even if the pending navigation wasn't committed -
184 // this is a "safety net" in case we mis-identify the destination webpage
185 // (which can happen if a new navigation is performed while while a GestureNav
186 // navigation is in progress).
184 contents()->TestSetIsLoading(true); 187 contents()->TestSetIsLoading(true);
185 contents()->TestSetIsLoading(false); 188 contents()->TestSetIsLoading(false);
186 EXPECT_FALSE(GetOverlay()->loading_complete_);
187
188 contents()->CommitPendingNavigation();
189 contents()->TestSetIsLoading(true);
190 contents()->TestSetIsLoading(false);
191 // Navigation was committed and the load update was received - the flag
192 // should now be updated.
193 EXPECT_TRUE(GetOverlay()->loading_complete_); 189 EXPECT_TRUE(GetOverlay()->loading_complete_);
194 190
195 EXPECT_FALSE(GetOverlay()->web_contents()); 191 EXPECT_FALSE(GetOverlay()->web_contents());
196 } 192 }
197 193
198 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/aura/overscroll_navigation_overlay.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698