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 scoped_refptr<HTTPTestServer> server = | 136 TestServer server(kDocRoot); |
137 HTTPTestServer::CreateServer(kDocRoot); | 137 GURL http_url1(server.TestServerPageW(L"files/title1.html")); |
138 ASSERT_TRUE(NULL != server.get()); | 138 GURL http_url2(server.TestServerPageW(L"files/title2.html")); |
139 GURL http_url1(server->TestServerPageW(L"files/title1.html")); | |
140 GURL http_url2(server->TestServerPageW(L"files/title2.html")); | |
141 | 139 |
142 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 140 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
143 int initial_tab_count; | 141 int initial_tab_count; |
144 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); | 142 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); |
145 | 143 |
146 // Add a tab | 144 // Add a tab |
147 browser_proxy->AppendTab(http_url1); | 145 browser_proxy->AppendTab(http_url1); |
148 int new_tab_count; | 146 int new_tab_count; |
149 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, | 147 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, |
150 &new_tab_count, | 148 &new_tab_count, |
(...skipping 20 matching lines...) Expand all Loading... |
171 ASSERT_EQ(http_url2, GetActiveTabURL()); | 169 ASSERT_EQ(http_url2, GetActiveTabURL()); |
172 ASSERT_TRUE(tab->GoBack()); | 170 ASSERT_TRUE(tab->GoBack()); |
173 ASSERT_EQ(http_url1, GetActiveTabURL()); | 171 ASSERT_EQ(http_url1, GetActiveTabURL()); |
174 } | 172 } |
175 | 173 |
176 // Tests that the SiteInstances used for entries in a restored tab's history | 174 // Tests that the SiteInstances used for entries in a restored tab's history |
177 // are given appropriate max page IDs, even if the renderer for the entry | 175 // are given appropriate max page IDs, even if the renderer for the entry |
178 // already exists. (Bug 1204135) | 176 // already exists. (Bug 1204135) |
179 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { | 177 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { |
180 const wchar_t kDocRoot[] = L"chrome/test/data"; | 178 const wchar_t kDocRoot[] = L"chrome/test/data"; |
181 scoped_refptr<HTTPTestServer> server = | 179 TestServer server(kDocRoot); |
182 HTTPTestServer::CreateServer(kDocRoot); | 180 GURL http_url1(server.TestServerPageW(L"files/title1.html")); |
183 ASSERT_TRUE(NULL != server.get()); | 181 GURL http_url2(server.TestServerPageW(L"files/title2.html")); |
184 GURL http_url1(server->TestServerPageW(L"files/title1.html")); | |
185 GURL http_url2(server->TestServerPageW(L"files/title2.html")); | |
186 | 182 |
187 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 183 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
188 int initial_tab_count; | 184 int initial_tab_count; |
189 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); | 185 ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); |
190 | 186 |
191 // Add a tab | 187 // Add a tab |
192 browser_proxy->AppendTab(http_url1); | 188 browser_proxy->AppendTab(http_url1); |
193 int new_tab_count; | 189 int new_tab_count; |
194 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, | 190 ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, |
195 &new_tab_count, | 191 &new_tab_count, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 GURL url; | 268 GURL url; |
273 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 269 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
274 ASSERT_TRUE(url == url1_); | 270 ASSERT_TRUE(url == url1_); |
275 | 271 |
276 restored_tab_proxy.reset( | 272 restored_tab_proxy.reset( |
277 browser_proxy->GetTab(initial_tab_count + 1)); | 273 browser_proxy->GetTab(initial_tab_count + 1)); |
278 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); | 274 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); |
279 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 275 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
280 ASSERT_TRUE(url == url2_); | 276 ASSERT_TRUE(url == url2_); |
281 } | 277 } |
OLD | NEW |