| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/common/frame_messages.h" | 10 #include "content/common/frame_messages.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 SetIsUsingLoFi(frame(), true); | 190 SetIsUsingLoFi(frame(), true); |
| 191 EXPECT_TRUE(GetMainRenderFrame()->IsUsingLoFi()); | 191 EXPECT_TRUE(GetMainRenderFrame()->IsUsingLoFi()); |
| 192 EXPECT_TRUE(frame()->IsUsingLoFi()); | 192 EXPECT_TRUE(frame()->IsUsingLoFi()); |
| 193 | 193 |
| 194 blink::WebHistoryItem item; | 194 blink::WebHistoryItem item; |
| 195 item.initialize(); | 195 item.initialize(); |
| 196 | 196 |
| 197 // The main frame's and subframe's LoFi states should stay the same on | 197 // The main frame's and subframe's LoFi states should stay the same on |
| 198 // navigations within the page. | 198 // navigations within the page. |
| 199 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, | 199 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, |
| 200 blink::WebStandardCommit); | 200 blink::WebStandardCommit, true); |
| 201 EXPECT_TRUE(frame()->IsUsingLoFi()); | 201 EXPECT_TRUE(frame()->IsUsingLoFi()); |
| 202 GetMainRenderFrame()->didNavigateWithinPage( | 202 GetMainRenderFrame()->didNavigateWithinPage( |
| 203 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); | 203 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, |
| 204 true); |
| 204 EXPECT_TRUE(GetMainRenderFrame()->IsUsingLoFi()); | 205 EXPECT_TRUE(GetMainRenderFrame()->IsUsingLoFi()); |
| 205 | 206 |
| 206 // The subframe's LoFi state should not be reset on commit. | 207 // The subframe's LoFi state should not be reset on commit. |
| 207 DocumentState* document_state = | 208 DocumentState* document_state = |
| 208 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); | 209 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); |
| 209 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 210 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
| 210 ->set_was_within_same_page(false); | 211 ->set_was_within_same_page(false); |
| 211 | 212 |
| 212 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, | 213 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, |
| 213 blink::WebStandardCommit); | 214 blink::WebStandardCommit); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 251 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
| 251 EXPECT_EQ(tests[i].type, | 252 EXPECT_EQ(tests[i].type, |
| 252 GetMainRenderFrame()->getEffectiveConnectionType()); | 253 GetMainRenderFrame()->getEffectiveConnectionType()); |
| 253 | 254 |
| 254 blink::WebHistoryItem item; | 255 blink::WebHistoryItem item; |
| 255 item.initialize(); | 256 item.initialize(); |
| 256 | 257 |
| 257 // The main frame's and subframe's effective connection type should stay the | 258 // The main frame's and subframe's effective connection type should stay the |
| 258 // same on navigations within the page. | 259 // same on navigations within the page. |
| 259 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, | 260 frame()->didNavigateWithinPage(frame()->GetWebFrame(), item, |
| 260 blink::WebStandardCommit); | 261 blink::WebStandardCommit, true); |
| 261 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 262 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
| 262 GetMainRenderFrame()->didNavigateWithinPage( | 263 GetMainRenderFrame()->didNavigateWithinPage( |
| 263 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit); | 264 GetMainRenderFrame()->GetWebFrame(), item, blink::WebStandardCommit, |
| 265 true); |
| 264 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); | 266 EXPECT_EQ(tests[i].type, frame()->getEffectiveConnectionType()); |
| 265 | 267 |
| 266 // The subframe's effective connection type should not be reset on commit. | 268 // The subframe's effective connection type should not be reset on commit. |
| 267 DocumentState* document_state = | 269 DocumentState* document_state = |
| 268 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); | 270 DocumentState::FromDataSource(frame()->GetWebFrame()->dataSource()); |
| 269 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 271 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
| 270 ->set_was_within_same_page(false); | 272 ->set_was_within_same_page(false); |
| 271 | 273 |
| 272 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, | 274 frame()->didCommitProvisionalLoad(frame()->GetWebFrame(), item, |
| 273 blink::WebStandardCommit); | 275 blink::WebStandardCommit); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 284 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, | 286 EXPECT_EQ(blink::WebEffectiveConnectionType::TypeUnknown, |
| 285 GetMainRenderFrame()->getEffectiveConnectionType()); | 287 GetMainRenderFrame()->getEffectiveConnectionType()); |
| 286 | 288 |
| 287 // The subframe would be deleted here after a cross-document navigation. | 289 // The subframe would be deleted here after a cross-document navigation. |
| 288 // It happens to be left around in this test because this does not simulate | 290 // It happens to be left around in this test because this does not simulate |
| 289 // the frame detach. | 291 // the frame detach. |
| 290 } | 292 } |
| 291 } | 293 } |
| 292 | 294 |
| 293 } // namespace | 295 } // namespace |
| OLD | NEW |