OLD | NEW |
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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); | 197 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); |
198 GetMainRenderFrame()->didNavigateWithinPage( | 198 GetMainRenderFrame()->didNavigateWithinPage( |
199 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, | 199 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, |
200 true); | 200 true); |
201 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState()); | 201 EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState()); |
202 | 202 |
203 // The subframe's LoFi state should not be reset on commit. | 203 // The subframe's LoFi state should not be reset on commit. |
204 DocumentState* document_state = | 204 DocumentState* document_state = |
205 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); | 205 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); |
206 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 206 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
207 ->set_was_within_same_page(false); | 207 ->set_was_within_same_document(false); |
208 | 208 |
209 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, | 209 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, |
210 blink::WebStandardCommit); | 210 blink::WebStandardCommit); |
211 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); | 211 EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); |
212 | 212 |
213 // The main frame's LoFi state should be reset to off on commit. | 213 // The main frame's LoFi state should be reset to off on commit. |
214 document_state = DocumentState::FromDataSource( | 214 document_state = DocumentState::FromDataSource( |
215 GetMainRenderFrame()->GetWebFrame()->dataSource()); | 215 GetMainRenderFrame()->GetWebFrame()->dataSource()); |
216 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 216 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
217 ->set_was_within_same_page(false); | 217 ->set_was_within_same_document(false); |
218 | 218 |
219 // Calling didCommitProvisionalLoad is not representative of a full navigation | 219 // Calling didCommitProvisionalLoad is not representative of a full navigation |
220 // but serves the purpose of testing the LoFi state logic. | 220 // but serves the purpose of testing the LoFi state logic. |
221 GetMainRenderFrame()->didCommitProvisionalLoad( | 221 GetMainRenderFrame()->didCommitProvisionalLoad( |
222 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); | 222 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); |
223 EXPECT_EQ(PREVIEWS_OFF, GetMainRenderFrame()->GetPreviewsState()); | 223 EXPECT_EQ(PREVIEWS_OFF, GetMainRenderFrame()->GetPreviewsState()); |
224 // The subframe would be deleted here after a cross-document navigation. It | 224 // The subframe would be deleted here after a cross-document navigation. It |
225 // happens to be left around in this test because this does not simulate the | 225 // happens to be left around in this test because this does not simulate the |
226 // frame detach. | 226 // frame detach. |
227 } | 227 } |
(...skipping 30 matching lines...) Expand all Loading... |
258 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 258 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
259 GetMainRenderFrame()->didNavigateWithinPage( | 259 GetMainRenderFrame()->didNavigateWithinPage( |
260 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, | 260 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, |
261 true); | 261 true); |
262 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 262 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
263 | 263 |
264 // The subframe's effective connection type should not be reset on commit. | 264 // The subframe's effective connection type should not be reset on commit. |
265 DocumentState* document_state = | 265 DocumentState* document_state = |
266 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); | 266 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); |
267 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 267 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
268 ->set_was_within_same_page(false); | 268 ->set_was_within_same_document(false); |
269 | 269 |
270 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, | 270 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, |
271 blink::WebStandardCommit); | 271 blink::WebStandardCommit); |
272 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 272 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
273 | 273 |
274 // The main frame's effective connection type should be reset on commit. | 274 // The main frame's effective connection type should be reset on commit. |
275 document_state = DocumentState::FromDataSource( | 275 document_state = DocumentState::FromDataSource( |
276 GetMainRenderFrame()->GetWebFrame()->dataSource()); | 276 GetMainRenderFrame()->GetWebFrame()->dataSource()); |
277 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 277 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
278 ->set_was_within_same_page(false); | 278 ->set_was_within_same_document(false); |
279 | 279 |
280 GetMainRenderFrame()->didCommitProvisionalLoad( | 280 GetMainRenderFrame()->didCommitProvisionalLoad( |
281 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); | 281 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); |
282 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, | 282 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, |
283 GetMainRenderFrame()->getEffectiveConnectionType()); | 283 GetMainRenderFrame()->getEffectiveConnectionType()); |
284 | 284 |
285 // The subframe would be deleted here after a cross-document navigation. | 285 // The subframe would be deleted here after a cross-document navigation. |
286 // It happens to be left around in this test because this does not simulate | 286 // It happens to be left around in this test because this does not simulate |
287 // the frame detach. | 287 // the frame detach. |
288 } | 288 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 blink::WebFindOptions options; | 370 blink::WebFindOptions options; |
371 options.force = true; | 371 options.force = true; |
372 FrameMsg_Find find_message(0, 1, base::ASCIIToUTF16("foo"), options); | 372 FrameMsg_Find find_message(0, 1, base::ASCIIToUTF16("foo"), options); |
373 frame()->OnMessageReceived(find_message); | 373 frame()->OnMessageReceived(find_message); |
374 | 374 |
375 FrameMsg_Delete delete_message(0); | 375 FrameMsg_Delete delete_message(0); |
376 frame()->OnMessageReceived(delete_message); | 376 frame()->OnMessageReceived(delete_message); |
377 } | 377 } |
378 | 378 |
379 } // namespace | 379 } // namespace |
OLD | NEW |