| 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 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 FLAKY_TestDoubleReload | 26 #define MAYBE_TestDoubleReload FLAKY_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 scoped_refptr<HTTPTestServer> server = | 32 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
| 33 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
| 34 ASSERT_TRUE(NULL != server.get()); | 33 ASSERT_TRUE(NULL != server.get()); |
| 35 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 34 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 36 ASSERT_TRUE(browser.get()); | 35 ASSERT_TRUE(browser.get()); |
| 37 | 36 |
| 38 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 37 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 39 ASSERT_TRUE(tab.get()); | 38 ASSERT_TRUE(tab.get()); |
| 40 | 39 |
| 41 // Load a form. | 40 // Load a form. |
| 42 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); | 41 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); |
| 43 // Submit it. | 42 // Submit it. |
| 44 ASSERT_TRUE(tab->NavigateToURL(GURL( | 43 ASSERT_TRUE(tab->NavigateToURL(GURL( |
| 45 "javascript:document.getElementById('form').submit()"))); | 44 "javascript:document.getElementById('form').submit()"))); |
| 46 | 45 |
| 47 // Try to reload it twice, checking for repost. | 46 // Try to reload it twice, checking for repost. |
| 48 tab->ReloadAsync(); | 47 tab->ReloadAsync(); |
| 49 tab->ReloadAsync(); | 48 tab->ReloadAsync(); |
| 50 | 49 |
| 51 // Navigate away from the page (this is when the test usually crashes). | 50 // Navigate away from the page (this is when the test usually crashes). |
| 52 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); | 51 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); |
| 53 } | 52 } |
| 54 | 53 |
| 55 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 56 // http://crbug.com/47228 | 55 // http://crbug.com/47228 |
| 57 #define MAYBE_TestLoginAfterRepost FLAKY_TestLoginAfterRepost | 56 #define MAYBE_TestLoginAfterRepost FLAKY_TestLoginAfterRepost |
| 58 #else | 57 #else |
| 59 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost | 58 #define MAYBE_TestLoginAfterRepost TestLoginAfterRepost |
| 60 #endif | 59 #endif |
| 61 | 60 |
| 62 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { | 61 TEST_F(RepostFormWarningTest, MAYBE_TestLoginAfterRepost) { |
| 63 scoped_refptr<HTTPTestServer> server = | 62 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
| 64 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
| 65 ASSERT_TRUE(NULL != server.get()); | 63 ASSERT_TRUE(NULL != server.get()); |
| 66 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 64 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 67 ASSERT_TRUE(browser.get()); | 65 ASSERT_TRUE(browser.get()); |
| 68 | 66 |
| 69 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 67 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 70 ASSERT_TRUE(tab.get()); | 68 ASSERT_TRUE(tab.get()); |
| 71 | 69 |
| 72 // Load a form. | 70 // Load a form. |
| 73 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); | 71 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("files/form.html"))); |
| 74 // Submit it. | 72 // Submit it. |
| 75 ASSERT_TRUE(tab->NavigateToURL(GURL( | 73 ASSERT_TRUE(tab->NavigateToURL(GURL( |
| 76 "javascript:document.getElementById('form').submit()"))); | 74 "javascript:document.getElementById('form').submit()"))); |
| 77 | 75 |
| 78 // Try to reload it, checking for repost. | 76 // Try to reload it, checking for repost. |
| 79 tab->ReloadAsync(); | 77 tab->ReloadAsync(); |
| 80 | 78 |
| 81 // Navigate to a page that requires authentication, bringing up another | 79 // Navigate to a page that requires authentication, bringing up another |
| 82 // tab-modal sheet. | 80 // tab-modal sheet. |
| 83 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("auth-basic"))); | 81 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("auth-basic"))); |
| 84 | 82 |
| 85 // Try to reload it again. | 83 // Try to reload it again. |
| 86 tab->ReloadAsync(); | 84 tab->ReloadAsync(); |
| 87 | 85 |
| 88 // Navigate away from the page. | 86 // Navigate away from the page. |
| 89 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); | 87 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPage("bar"))); |
| 90 } | 88 } |
| OLD | NEW |