| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 scoped_refptr<HTTPTestServer> server = | 25 scoped_refptr<HTTPTestServer> server = |
| 26 HTTPTestServer::CreateServer(kDocRoot, NULL); | 26 HTTPTestServer::CreateServer(kDocRoot, NULL); |
| 27 ASSERT_TRUE(NULL != server.get()); | 27 ASSERT_TRUE(NULL != server.get()); |
| 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 29 ASSERT_TRUE(browser.get()); | 29 ASSERT_TRUE(browser.get()); |
| 30 | 30 |
| 31 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 31 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 32 ASSERT_TRUE(tab.get()); | 32 ASSERT_TRUE(tab.get()); |
| 33 | 33 |
| 34 // Load a form. | 34 // Load a form. |
| 35 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html"))); | 35 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); |
| 36 // Submit it. | 36 // Submit it. |
| 37 ASSERT_TRUE(tab->NavigateToURL(GURL( | 37 ASSERT_TRUE(tab->NavigateToURL(GURL( |
| 38 "javascript:document.getElementById('form').submit()"))); | 38 "javascript:document.getElementById('form').submit()"))); |
| 39 | 39 |
| 40 // Try to reload it twice, checking for repost. | 40 // Try to reload it twice, checking for repost. |
| 41 tab->ReloadAsync(); | 41 tab->ReloadAsync(); |
| 42 tab->ReloadAsync(); | 42 tab->ReloadAsync(); |
| 43 | 43 |
| 44 // Navigate away from the page (this is when the test usually crashes). | 44 // Navigate away from the page (this is when the test usually crashes). |
| 45 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar"))); | 45 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { | 48 TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { |
| 49 scoped_refptr<HTTPTestServer> server = | 49 scoped_refptr<HTTPTestServer> server = |
| 50 HTTPTestServer::CreateServer(kDocRoot, NULL); | 50 HTTPTestServer::CreateServer(kDocRoot, NULL); |
| 51 ASSERT_TRUE(NULL != server.get()); | 51 ASSERT_TRUE(NULL != server.get()); |
| 52 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 52 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 53 ASSERT_TRUE(browser.get()); | 53 ASSERT_TRUE(browser.get()); |
| 54 | 54 |
| 55 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 55 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 56 ASSERT_TRUE(tab.get()); | 56 ASSERT_TRUE(tab.get()); |
| 57 | 57 |
| 58 // Load a form. | 58 // Load a form. |
| 59 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html"))); | 59 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); |
| 60 // Submit it. | 60 // Submit it. |
| 61 ASSERT_TRUE(tab->NavigateToURL(GURL( | 61 ASSERT_TRUE(tab->NavigateToURL(GURL( |
| 62 "javascript:document.getElementById('form').submit()"))); | 62 "javascript:document.getElementById('form').submit()"))); |
| 63 | 63 |
| 64 // Try to reload it, checking for repost. | 64 // Try to reload it, checking for repost. |
| 65 tab->ReloadAsync(); | 65 tab->ReloadAsync(); |
| 66 | 66 |
| 67 // Navigate to a page that requires authentication, bringing up another | 67 // Navigate to a page that requires authentication, bringing up another |
| 68 // tab-modal sheet. | 68 // tab-modal sheet. |
| 69 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"auth-basic"))); | 69 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("auth-basic"))); |
| 70 | 70 |
| 71 // Try to reload it again. | 71 // Try to reload it again. |
| 72 tab->ReloadAsync(); | 72 tab->ReloadAsync(); |
| 73 | 73 |
| 74 // Navigate away from the page. | 74 // Navigate away from the page. |
| 75 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar"))); | 75 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); |
| 76 } | 76 } |
| OLD | NEW |