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

Side by Side Diff: content/renderer/render_frame_impl_browsertest.cc

Issue 2655143002: Drop replacesCurrentHistoryItem, NavigationType (Closed)
Patch Set: More compile fixes Created 3 years, 10 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/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/leak_annotations.h" 8 #include "base/debug/leak_annotations.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/child/web_url_loader_impl.h" 10 #include "content/child/web_url_loader_impl.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SetPreviewsState(GetMainRenderFrame(), SERVER_LOFI_ON); 184 SetPreviewsState(GetMainRenderFrame(), SERVER_LOFI_ON);
185 SetPreviewsState(frame(), SERVER_LOFI_ON); 185 SetPreviewsState(frame(), SERVER_LOFI_ON);
186 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState()); 186 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState());
187 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); 187 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState());
188 188
189 blink::WebHistoryItem item; 189 blink::WebHistoryItem item;
190 item.initialize(); 190 item.initialize();
191 191
192 // The main frame's and subframe's LoFi states should stay the same on 192 // The main frame's and subframe's LoFi states should stay the same on
193 // navigations within the page. 193 // navigations within the page.
194 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, 194 frame()->didNavigateWithinPage(frame()->GetWebFrame()->dataSource(),
195 blink::WebFrameLoadType::Standard, item,
195 blink::WebStandardCommit, true); 196 blink::WebStandardCommit, true);
196 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); 197 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState());
197 GetMainRenderFrame()->didNavigateWithinPage( 198 GetMainRenderFrame()->didNavigateWithinPage(
198 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, 199 GetMainRenderFrame()->GetWebFrame()->dataSource(),
200 blink::WebFrameLoadType::Standard, item, blink::WebStandardCommit,
199 true); 201 true);
200 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState()); 202 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState());
201 203
202 // The subframe's LoFi state should not be reset on commit. 204 // The subframe's LoFi state should not be reset on commit.
203 DocumentState* document_state = 205 DocumentState* document_state =
204 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); 206 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource());
205 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 207 static_cast<NavigationStateImpl*>(document_state->navigation_state())
206 ->set_was_within_same_page(false); 208 ->set_was_within_same_page(false);
207 209
208 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, 210 frame()->didCommitProvisionalLoad(frame()->GetWebFrame()->dataSource(),
211 blink::WebFrameLoadType::Standard, item,
209 blink::WebStandardCommit); 212 blink::WebStandardCommit);
210 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); 213 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState());
211 214
212 // The main frame's LoFi state should be reset to off on commit. 215 // The main frame's LoFi state should be reset to off on commit.
213 document_state = DocumentState::FromDataSource( 216 document_state = DocumentState::FromDataSource(
214 GetMainRenderFrame()->GetWebFrame()->dataSource()); 217 GetMainRenderFrame()->GetWebFrame()->dataSource());
215 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 218 static_cast<NavigationStateImpl*>(document_state->navigation_state())
216 ->set_was_within_same_page(false); 219 ->set_was_within_same_page(false);
217 220
218 // Calling didCommitProvisionalLoad is not representative of a full navigation 221 // Calling didCommitProvisionalLoad is not representative of a full navigation
219 // but serves the purpose of testing the LoFi state logic. 222 // but serves the purpose of testing the LoFi state logic.
220 GetMainRenderFrame()->didCommitProvisionalLoad( 223 GetMainRenderFrame()->didCommitProvisionalLoad(
221 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); 224 GetMainRenderFrame()->GetWebFrame()->dataSource(),
225 blink::WebFrameLoadType::Standard, item, blink::WebStandardCommit);
222 EXPECT_EQ(PREVIEWS_OFF, GetMainRenderFrame()->GetPreviewsState()); 226 EXPECT_EQ(PREVIEWS_OFF, GetMainRenderFrame()->GetPreviewsState());
223 // The subframe would be deleted here after a cross-document navigation. It 227 // The subframe would be deleted here after a cross-document navigation. It
224 // happens to be left around in this test because this does not simulate the 228 // happens to be left around in this test because this does not simulate the
225 // frame detach. 229 // frame detach.
226 } 230 }
227 231
228 // Test that effective connection type only updates for new main frame 232 // Test that effective connection type only updates for new main frame
229 // documents. 233 // documents.
230 TEST_F(RenderFrameImplTest, EffectiveConnectionType) { 234 TEST_F(RenderFrameImplTest, EffectiveConnectionType) {
231 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, 235 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown,
(...skipping 13 matching lines...) Expand all
245 249
246 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); 250 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType());
247 EXPECT_EQ(tests[i].type, 251 EXPECT_EQ(tests[i].type,
248 GetMainRenderFrame()->getEffectiveConnectionType()); 252 GetMainRenderFrame()->getEffectiveConnectionType());
249 253
250 blink::WebHistoryItem item; 254 blink::WebHistoryItem item;
251 item.initialize(); 255 item.initialize();
252 256
253 // The main frame's and subframe's effective connection type should stay the 257 // The main frame's and subframe's effective connection type should stay the
254 // same on navigations within the page. 258 // same on navigations within the page.
255 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, 259 frame()->didNavigateWithinPage(frame()->GetWebFrame()->dataSource(),
260 blink::WebFrameLoadType::Standard, item,
256 blink::WebStandardCommit, true); 261 blink::WebStandardCommit, true);
257 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); 262 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType());
258 GetMainRenderFrame()->didNavigateWithinPage( 263 GetMainRenderFrame()->didNavigateWithinPage(
259 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, 264 GetMainRenderFrame()->GetWebFrame()->dataSource(),
265 blink::WebFrameLoadType::Standard, item, blink::WebStandardCommit,
260 true); 266 true);
261 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); 267 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType());
262 268
263 // The subframe's effective connection type should not be reset on commit. 269 // The subframe's effective connection type should not be reset on commit.
264 DocumentState* document_state = 270 DocumentState* document_state =
265 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); 271 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource());
266 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 272 static_cast<NavigationStateImpl*>(document_state->navigation_state())
267 ->set_was_within_same_page(false); 273 ->set_was_within_same_page(false);
268 274
269 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, 275 frame()->didCommitProvisionalLoad(frame()->GetWebFrame()->dataSource(),
276 blink::WebFrameLoadType::Standard, item,
270 blink::WebStandardCommit); 277 blink::WebStandardCommit);
271 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); 278 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType());
272 279
273 // The main frame's effective connection type should be reset on commit. 280 // The main frame's effective connection type should be reset on commit.
274 document_state = DocumentState::FromDataSource( 281 document_state = DocumentState::FromDataSource(
275 GetMainRenderFrame()->GetWebFrame()->dataSource()); 282 GetMainRenderFrame()->GetWebFrame()->dataSource());
276 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 283 static_cast<NavigationStateImpl*>(document_state->navigation_state())
277 ->set_was_within_same_page(false); 284 ->set_was_within_same_page(false);
278 285
279 GetMainRenderFrame()->didCommitProvisionalLoad( 286 GetMainRenderFrame()->didCommitProvisionalLoad(
280 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); 287 GetMainRenderFrame()->GetWebFrame()->dataSource(),
288 blink::WebFrameLoadType::Standard, item, blink::WebStandardCommit);
281 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, 289 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown,
282 GetMainRenderFrame()->getEffectiveConnectionType()); 290 GetMainRenderFrame()->getEffectiveConnectionType());
283 291
284 // The subframe would be deleted here after a cross-document navigation. 292 // The subframe would be deleted here after a cross-document navigation.
285 // It happens to be left around in this test because this does not simulate 293 // It happens to be left around in this test because this does not simulate
286 // the frame detach. 294 // the frame detach.
287 } 295 }
288 } 296 }
289 297
290 TEST_F(RenderFrameImplTest, SaveImageFromDataURL) { 298 TEST_F(RenderFrameImplTest, SaveImageFromDataURL) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 common_params.url = GURL("data:text/html,max_zoomlimit_test"); 363 common_params.url = GURL("data:text/html,max_zoomlimit_test");
356 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel); 364 GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel);
357 GetMainRenderFrame()->NavigateInternal( 365 GetMainRenderFrame()->NavigateInternal(
358 common_params, StartNavigationParams(), RequestNavigationParams(), 366 common_params, StartNavigationParams(), RequestNavigationParams(),
359 std::unique_ptr<StreamOverrideParameters>()); 367 std::unique_ptr<StreamOverrideParameters>());
360 ProcessPendingMessages(); 368 ProcessPendingMessages();
361 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel()); 369 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->zoomLevel());
362 } 370 }
363 371
364 } // namespace 372 } // namespace
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698