| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/automation_proxy.h" | 10 #include "chrome/test/automation/automation_proxy.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 typedef UITest RepostFormWarningTest; | 22 typedef UITest RepostFormWarningTest; |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 // http://crbug.com/47228 | 25 // http://crbug.com/47228 |
| 26 #define MAYBE_TestDoubleReload DISABLED_TestDoubleReload | 26 #define MAYBE_TestDoubleReload DISABLED_TestDoubleReload |
| 27 #else | 27 #else |
| 28 #define MAYBE_TestDoubleReload TestDoubleReload | 28 #define MAYBE_TestDoubleReload TestDoubleReload |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 TEST_F(RepostFormWarningTest, MAYBE_TestDoubleReload) { | 31 TEST_F(RepostFormWarningTest, MAYBE_TestDoubleReload) { |
| 32 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); | 32 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 33 net::TestServer::kLocalhost, |
| 34 FilePath(kDocRoot)); |
| 33 ASSERT_TRUE(test_server.Start()); | 35 ASSERT_TRUE(test_server.Start()); |
| 34 | 36 |
| 35 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 37 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 36 ASSERT_TRUE(browser.get()); | 38 ASSERT_TRUE(browser.get()); |
| 37 | 39 |
| 38 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 40 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 39 ASSERT_TRUE(tab.get()); | 41 ASSERT_TRUE(tab.get()); |
| 40 | 42 |
| 41 // Load a form. | 43 // Load a form. |
| 42 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); | 44 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 62 } | 64 } |
| 63 | 65 |
| 64 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 65 // http://crbug.com/47228 | 67 // http://crbug.com/47228 |
| 66 #define MAYBE_TestLoginAfterRepost DISABLED_TestLoginAfterRepost | 68 #define MAYBE_TestLoginAfterRepost DISABLED_TestLoginAfterRepost |
| 67 #else | 69 #else |
| 68 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost | 70 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost |
| 69 #endif | 71 #endif |
| 70 | 72 |
| 71 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { | 73 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { |
| 72 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); | 74 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 75 net::TestServer::kLocalhost, |
| 76 FilePath(kDocRoot)); |
| 73 ASSERT_TRUE(test_server.Start()); | 77 ASSERT_TRUE(test_server.Start()); |
| 74 | 78 |
| 75 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 79 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 76 ASSERT_TRUE(browser.get()); | 80 ASSERT_TRUE(browser.get()); |
| 77 | 81 |
| 78 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 82 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 79 ASSERT_TRUE(tab.get()); | 83 ASSERT_TRUE(tab.get()); |
| 80 | 84 |
| 81 // Load a form. | 85 // Load a form. |
| 82 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); | 86 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("files/form.html"))); |
| 83 // Submit it. | 87 // Submit it. |
| 84 ASSERT_TRUE(tab->NavigateToURL(GURL( | 88 ASSERT_TRUE(tab->NavigateToURL(GURL( |
| 85 "javascript:document.getElementById('form').submit()"))); | 89 "javascript:document.getElementById('form').submit()"))); |
| 86 | 90 |
| 87 // Try to reload it, checking for repost. | 91 // Try to reload it, checking for repost. |
| 88 tab->ReloadAsync(); | 92 tab->ReloadAsync(); |
| 89 | 93 |
| 90 // Navigate to a page that requires authentication, bringing up another | 94 // Navigate to a page that requires authentication, bringing up another |
| 91 // tab-modal sheet. | 95 // tab-modal sheet. |
| 92 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("auth-basic"))); | 96 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("auth-basic"))); |
| 93 | 97 |
| 94 // Try to reload it again. | 98 // Try to reload it again. |
| 95 tab->ReloadAsync(); | 99 tab->ReloadAsync(); |
| 96 | 100 |
| 97 // Navigate away from the page. | 101 // Navigate away from the page. |
| 98 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); | 102 ASSERT_TRUE(tab->NavigateToURL(test_server.GetURL("bar"))); |
| 99 } | 103 } |
| OLD | NEW |