OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/test/automation/tab_proxy.h" | 13 #include "chrome/test/automation/tab_proxy.h" |
14 #include "chrome/test/automation/browser_proxy.h" | 14 #include "chrome/test/automation/browser_proxy.h" |
15 #include "chrome/test/automation/window_proxy.h" | 15 #include "chrome/test/automation/window_proxy.h" |
16 #include "chrome/test/ui/ui_test.h" | 16 #include "chrome/test/ui/ui_test.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
19 #include "net/url_request/url_request_unittest.h" | 19 #include "net/test/test_server.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 class SessionRestoreUITest : public UITest { | 23 class SessionRestoreUITest : public UITest { |
24 protected: | 24 protected: |
25 SessionRestoreUITest() : UITest() { | 25 SessionRestoreUITest() : UITest() { |
26 FilePath path_prefix = test_data_directory_.AppendASCII("session_history"); | 26 FilePath path_prefix = test_data_directory_.AppendASCII("session_history"); |
27 | 27 |
28 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); | 28 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); |
29 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); | 29 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ASSERT_TRUE(GetActiveTabURL() == url2_); | 138 ASSERT_TRUE(GetActiveTabURL() == url2_); |
139 ASSERT_TRUE(tab_proxy->GoBack()); | 139 ASSERT_TRUE(tab_proxy->GoBack()); |
140 ASSERT_TRUE(GetActiveTabURL() == url1_); | 140 ASSERT_TRUE(GetActiveTabURL() == url1_); |
141 } | 141 } |
142 | 142 |
143 // Tests that the SiteInstances used for entries in a restored tab's history | 143 // Tests that the SiteInstances used for entries in a restored tab's history |
144 // are given appropriate max page IDs, so that going back to a restored | 144 // are given appropriate max page IDs, so that going back to a restored |
145 // cross-site page and then forward again works. (Bug 1204135) | 145 // cross-site page and then forward again works. (Bug 1204135) |
146 TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) { | 146 TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) { |
147 const wchar_t kDocRoot[] = L"chrome/test/data"; | 147 const wchar_t kDocRoot[] = L"chrome/test/data"; |
148 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); | 148 scoped_refptr<net::HTTPTestServer> server( |
| 149 net::HTTPTestServer::CreateServer(kDocRoot)); |
149 ASSERT_TRUE(NULL != server.get()); | 150 ASSERT_TRUE(NULL != server.get()); |
150 GURL cross_site_url(server->TestServerPage("files/title2.html")); | 151 GURL cross_site_url(server->TestServerPage("files/title2.html")); |
151 | 152 |
152 // Visit URLs on different sites. | 153 // Visit URLs on different sites. |
153 NavigateToURL(url1_); | 154 NavigateToURL(url1_); |
154 NavigateToURL(cross_site_url); | 155 NavigateToURL(cross_site_url); |
155 NavigateToURL(url2_); | 156 NavigateToURL(url2_); |
156 | 157 |
157 scoped_refptr<TabProxy> active_tab(GetActiveTab()); | 158 scoped_refptr<TabProxy> active_tab(GetActiveTab()); |
158 ASSERT_TRUE(active_tab.get()); | 159 ASSERT_TRUE(active_tab.get()); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 ASSERT_TRUE(tab_proxy.get() != NULL); | 481 ASSERT_TRUE(tab_proxy.get() != NULL); |
481 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); | 482 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); |
482 tab_proxy = browser_proxy->GetTab(tab_count - 1); | 483 tab_proxy = browser_proxy->GetTab(tab_count - 1); |
483 ASSERT_TRUE(tab_proxy.get() != NULL); | 484 ASSERT_TRUE(tab_proxy.get() != NULL); |
484 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); | 485 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); |
485 | 486 |
486 ASSERT_EQ(expected_process_count, GetBrowserProcessCount()); | 487 ASSERT_EQ(expected_process_count, GetBrowserProcessCount()); |
487 } | 488 } |
488 | 489 |
489 } // namespace | 490 } // namespace |
OLD | NEW |