Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/browser/repost_form_warning_uitest.cc

Issue 1547003: [GTTF] Miscellanous UI tests cleanups: (Closed)
Patch Set: updated Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/test/automation/tab_proxy.h" 11 #include "chrome/test/automation/tab_proxy.h"
12 #include "chrome/test/automation/browser_proxy.h" 12 #include "chrome/test/automation/browser_proxy.h"
13 #include "chrome/test/ui/ui_test.h" 13 #include "chrome/test/ui/ui_test.h"
14 #include "net/url_request/url_request_unittest.h" 14 #include "net/url_request/url_request_unittest.h"
15 15
16 using std::wstring;
17
18 namespace { 16 namespace {
19 17
20 const wchar_t kDocRoot[] = L"chrome/test/data"; 18 const wchar_t kDocRoot[] = L"chrome/test/data";
21 19
22 } // namespace 20 } // namespace
23 21
24 class RepostFormWarningTest : public UITest { 22 typedef UITest RepostFormWarningTest;
25 };
26
27 23
28 TEST_F(RepostFormWarningTest, TestDoubleReload) { 24 TEST_F(RepostFormWarningTest, TestDoubleReload) {
29 scoped_refptr<HTTPTestServer> server = 25 scoped_refptr<HTTPTestServer> server =
30 HTTPTestServer::CreateServer(kDocRoot, NULL); 26 HTTPTestServer::CreateServer(kDocRoot, NULL);
31 ASSERT_TRUE(NULL != server.get()); 27 ASSERT_TRUE(NULL != server.get());
32 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
33 EXPECT_TRUE(browser.get()); 29 ASSERT_TRUE(browser.get());
34 30
35 scoped_refptr<TabProxy> tab(browser->GetTab(0)); 31 scoped_refptr<TabProxy> tab(browser->GetTab(0));
32 ASSERT_TRUE(tab.get());
36 33
37 // Load a form. 34 // Load a form.
38 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html"))); 35 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html")));
39 // Submit it. 36 // Submit it.
40 ASSERT_TRUE(tab->NavigateToURL(GURL( 37 ASSERT_TRUE(tab->NavigateToURL(GURL(
41 "javascript:document.getElementById('form').submit()"))); 38 "javascript:document.getElementById('form').submit()")));
42 39
43 // Try to reload it twice, checking for repost. 40 // Try to reload it twice, checking for repost.
44 tab->ReloadAsync(); 41 tab->ReloadAsync();
45 tab->ReloadAsync(); 42 tab->ReloadAsync();
46 43
47 // 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).
48 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar"))); 45 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar")));
49 } 46 }
50 47
51 TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { 48 TEST_F(RepostFormWarningTest, TestLoginAfterRepost) {
52 scoped_refptr<HTTPTestServer> server = 49 scoped_refptr<HTTPTestServer> server =
53 HTTPTestServer::CreateServer(kDocRoot, NULL); 50 HTTPTestServer::CreateServer(kDocRoot, NULL);
54 ASSERT_TRUE(NULL != server.get()); 51 ASSERT_TRUE(NULL != server.get());
55 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 52 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
56 ASSERT_TRUE(browser.get()); 53 ASSERT_TRUE(browser.get());
57 54
58 scoped_refptr<TabProxy> tab(browser->GetTab(0)); 55 scoped_refptr<TabProxy> tab(browser->GetTab(0));
56 ASSERT_TRUE(tab.get());
59 57
60 // Load a form. 58 // Load a form.
61 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html"))); 59 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"files/form.html")));
62 // Submit it. 60 // Submit it.
63 ASSERT_TRUE(tab->NavigateToURL(GURL( 61 ASSERT_TRUE(tab->NavigateToURL(GURL(
64 "javascript:document.getElementById('form').submit()"))); 62 "javascript:document.getElementById('form').submit()")));
65 63
66 // Try to reload it, checking for repost. 64 // Try to reload it, checking for repost.
67 tab->ReloadAsync(); 65 tab->ReloadAsync();
68 66
69 // Navigate to a page that requires authentication, bringing up another 67 // Navigate to a page that requires authentication, bringing up another
70 // tab-modal sheet. 68 // tab-modal sheet.
71 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"auth-basic"))); 69 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"auth-basic")));
72 70
73 // Try to reload it again. 71 // Try to reload it again.
74 tab->ReloadAsync(); 72 tab->ReloadAsync();
75 73
76 // Navigate away from the page. 74 // Navigate away from the page.
77 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar"))); 75 ASSERT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"bar")));
78 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win_uitest.cc ('k') | chrome/browser/session_history_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698