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_util.h" | 6 #include "base/file_util.h" |
7 #include "base/win_util.h" | 7 #include "base/win_util.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // And make sure the URLs matches. | 126 // And make sure the URLs matches. |
127 ASSERT_EQ(url2_, GetActiveTabURL()); | 127 ASSERT_EQ(url2_, GetActiveTabURL()); |
128 ASSERT_TRUE(tab_proxy->GoBack()); | 128 ASSERT_TRUE(tab_proxy->GoBack()); |
129 ASSERT_EQ(url1_, GetActiveTabURL()); | 129 ASSERT_EQ(url1_, GetActiveTabURL()); |
130 } | 130 } |
131 | 131 |
132 // Tests that a duplicate history entry is not created when we restore a page | 132 // Tests that a duplicate history entry is not created when we restore a page |
133 // to an existing SiteInstance. (Bug 1230446) | 133 // to an existing SiteInstance. (Bug 1230446) |
134 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { | 134 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { |
135 const wchar_t kDocRoot[] = L"chrome/test/data"; | 135 const wchar_t kDocRoot[] = L"chrome/test/data"; |
136 TestServer server(kDocRoot); | 136 scoped_refptr<HTTPTestServer> server = |
137 GURL http_url1(server.TestServerPageW(L"files/title1.html")); | 137 HTTPTestServer::CreateServer(kDocRoot); |
138 GURL http_url2(server.TestServerPageW(L"files/title2.html")); | 138 ASSERT_TRUE(NULL != server.get()); |
| 139 GURL http_url1(server->TestServerPageW(L"files/title1.html")); |
| 140 GURL http_url2(server->TestServerPageW(L"files/title2.html")); |
139 | 141 |
140 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 142 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
141 int initial_tab_count; | 143 int initial_tab_count; |
142 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); | 144 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); |
143 | 145 |
144 // Add a tab | 146 // Add a tab |
145 browser_proxy->AppendTab(http_url1); | 147 browser_proxy->AppendTab(http_url1); |
146 int new_tab_count; | 148 int new_tab_count; |
147 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, | 149 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, |
148 &new_tab_count, | 150 &new_tab_count, |
(...skipping 20 matching lines...) Expand all Loading... |
169 ASSERT_EQ(http_url2, GetActiveTabURL()); | 171 ASSERT_EQ(http_url2, GetActiveTabURL()); |
170 ASSERT_TRUE(tab->GoBack()); | 172 ASSERT_TRUE(tab->GoBack()); |
171 ASSERT_EQ(http_url1, GetActiveTabURL()); | 173 ASSERT_EQ(http_url1, GetActiveTabURL()); |
172 } | 174 } |
173 | 175 |
174 // Tests that the SiteInstances used for entries in a restored tab's history | 176 // Tests that the SiteInstances used for entries in a restored tab's history |
175 // are given appropriate max page IDs, even if the renderer for the entry | 177 // are given appropriate max page IDs, even if the renderer for the entry |
176 // already exists. (Bug 1204135) | 178 // already exists. (Bug 1204135) |
177 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { | 179 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { |
178 const wchar_t kDocRoot[] = L"chrome/test/data"; | 180 const wchar_t kDocRoot[] = L"chrome/test/data"; |
179 TestServer server(kDocRoot); | 181 scoped_refptr<HTTPTestServer> server = |
180 GURL http_url1(server.TestServerPageW(L"files/title1.html")); | 182 HTTPTestServer::CreateServer(kDocRoot); |
181 GURL http_url2(server.TestServerPageW(L"files/title2.html")); | 183 ASSERT_TRUE(NULL != server.get()); |
| 184 GURL http_url1(server->TestServerPageW(L"files/title1.html")); |
| 185 GURL http_url2(server->TestServerPageW(L"files/title2.html")); |
182 | 186 |
183 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 187 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
184 int initial_tab_count; | 188 int initial_tab_count; |
185 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); | 189 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); |
186 | 190 |
187 // Add a tab | 191 // Add a tab |
188 browser_proxy->AppendTab(http_url1); | 192 browser_proxy->AppendTab(http_url1); |
189 int new_tab_count; | 193 int new_tab_count; |
190 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, | 194 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, |
191 &new_tab_count, | 195 &new_tab_count, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 GURL url; | 272 GURL url; |
269 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 273 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
270 ASSERT_TRUE(url == url1_); | 274 ASSERT_TRUE(url == url1_); |
271 | 275 |
272 restored_tab_proxy.reset( | 276 restored_tab_proxy.reset( |
273 browser_proxy->GetTab(initial_tab_count + 1)); | 277 browser_proxy->GetTab(initial_tab_count + 1)); |
274 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); | 278 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); |
275 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 279 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
276 ASSERT_TRUE(url == url2_); | 280 ASSERT_TRUE(url == url2_); |
277 } | 281 } |
OLD | NEW |