OLD | NEW |
---|---|
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/browser/frame_host/frame_navigation_entry.h" | 8 #include "content/browser/frame_host/frame_navigation_entry.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/navigation_controller_impl.h" | 10 #include "content/browser/frame_host/navigation_controller_impl.h" |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1541 EXPECT_EQ( | 1541 EXPECT_EQ( |
1542 " Site A ------------ proxies for B\n" | 1542 " Site A ------------ proxies for B\n" |
1543 " |--Site A ------- proxies for B\n" | 1543 " |--Site A ------- proxies for B\n" |
1544 " +--Site B ------- proxies for A\n" | 1544 " +--Site B ------- proxies for A\n" |
1545 "Where A = http://127.0.0.1/\n" | 1545 "Where A = http://127.0.0.1/\n" |
1546 " B = http://baz.com/", | 1546 " B = http://baz.com/", |
1547 visualizer.DepictFrameTree(root)); | 1547 visualizer.DepictFrameTree(root)); |
1548 } | 1548 } |
1549 } | 1549 } |
1550 | 1550 |
1551 // Verifies that item sequence numbers and document sequence numbers update | |
1552 // properly for main frames and subframes. | |
1553 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | |
1554 FrameNavigationEntry_SequenceNumbers) { | |
1555 const NavigationControllerImpl& controller = | |
1556 static_cast<const NavigationControllerImpl&>( | |
1557 shell()->web_contents()->GetController()); | |
1558 | |
1559 // 1. Navigate the main frame. | |
1560 GURL url2(embedded_test_server()->GetURL( | |
1561 "/navigation_controller/page_with_links.html")); | |
1562 NavigateToURL(shell(), url2); | |
1563 FrameTreeNode* root = | |
1564 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
1565 GetFrameTree()->root(); | |
1566 | |
1567 FrameNavigationEntry* frame_entry = | |
1568 controller.GetLastCommittedEntry()->root_node()->frame_entry.get(); | |
1569 int64 isn_1 = frame_entry->item_sequence_number(); | |
1570 int64 dsn_1 = frame_entry->document_sequence_number(); | |
1571 EXPECT_NE(-1, isn_1); | |
1572 EXPECT_NE(-1, dsn_1); | |
Avi (use Gerrit)
2015/06/18 00:57:00
-1? I would have thought that would be a "not assi
Charlie Reis
2015/06/18 20:30:17
Right: EXPECT_NE.
| |
1573 | |
1574 // 2. Do an in-page fragment navigation. | |
1575 std::string script = "document.getElementById('fraglink').click()"; | |
1576 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script)); | |
1577 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | |
1578 | |
1579 frame_entry = | |
1580 controller.GetLastCommittedEntry()->root_node()->frame_entry.get(); | |
1581 int64 isn_2 = frame_entry->item_sequence_number(); | |
1582 int64 dsn_2 = frame_entry->document_sequence_number(); | |
1583 EXPECT_NE(-1, isn_2); | |
1584 EXPECT_NE(isn_1, isn_2); | |
1585 EXPECT_EQ(dsn_1, dsn_2); | |
Avi (use Gerrit)
2015/06/18 00:57:00
So document sequence numbers are sometimes shared
Charlie Reis
2015/06/18 20:30:17
It's from Blink, so I assume the answer is no. Th
| |
1586 | |
1587 // TODO(creis): Add a subframe test. | |
Charlie Reis
2015/06/17 22:56:23
I'll add this as well.
(I was debating checking t
Charlie Reis
2015/06/18 20:30:17
Done.
| |
1588 } | |
1589 | |
1551 namespace { | 1590 namespace { |
1552 | 1591 |
1553 class HttpThrottle : public ResourceThrottle { | 1592 class HttpThrottle : public ResourceThrottle { |
1554 public: | 1593 public: |
1555 // ResourceThrottle | 1594 // ResourceThrottle |
1556 void WillStartRequest(bool* defer) override { | 1595 void WillStartRequest(bool* defer) override { |
1557 *defer = true; | 1596 *defer = true; |
1558 } | 1597 } |
1559 | 1598 |
1560 const char* GetNameForLogging() const override { | 1599 const char* GetNameForLogging() const override { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 // tricky. | 1934 // tricky. |
1896 EXPECT_EQ(nullptr, controller.GetPendingEntry()); | 1935 EXPECT_EQ(nullptr, controller.GetPendingEntry()); |
1897 shell()->web_contents()->Stop(); | 1936 shell()->web_contents()->Stop(); |
1898 watcher.Wait(); | 1937 watcher.Wait(); |
1899 } | 1938 } |
1900 | 1939 |
1901 ResourceDispatcherHost::Get()->SetDelegate(nullptr); | 1940 ResourceDispatcherHost::Get()->SetDelegate(nullptr); |
1902 } | 1941 } |
1903 | 1942 |
1904 } // namespace content | 1943 } // namespace content |
OLD | NEW |