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 <string> | 5 #include <string> |
6 | 6 |
7 #include "chrome/browser/net/url_fixer_upper.h" | 7 #include "chrome/browser/net/url_fixer_upper.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 11 #include "chrome/test/automation/browser_proxy.h" |
11 #include "chrome/test/ui/ui_test.h" | 12 #include "chrome/test/ui/ui_test.h" |
12 #include "net/url_request/url_request_unittest.h" | 13 #include "net/url_request/url_request_unittest.h" |
13 | 14 |
14 using std::wstring; | 15 using std::wstring; |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const wchar_t kDocRoot[] = L"chrome/test/data"; | 19 const wchar_t kDocRoot[] = L"chrome/test/data"; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 107 |
107 // Test that logging in on 2 tabs at once works. | 108 // Test that logging in on 2 tabs at once works. |
108 TEST_F(LoginPromptTest, TestTwoAuths) { | 109 TEST_F(LoginPromptTest, TestTwoAuths) { |
109 scoped_refptr<HTTPTestServer> server = | 110 scoped_refptr<HTTPTestServer> server = |
110 HTTPTestServer::CreateServer(kDocRoot, NULL); | 111 HTTPTestServer::CreateServer(kDocRoot, NULL); |
111 ASSERT_TRUE(NULL != server.get()); | 112 ASSERT_TRUE(NULL != server.get()); |
112 | 113 |
113 scoped_refptr<TabProxy> basic_tab(GetActiveTabProxy()); | 114 scoped_refptr<TabProxy> basic_tab(GetActiveTabProxy()); |
114 NavigateTab(basic_tab.get(), server->TestServerPageW(L"auth-basic")); | 115 NavigateTab(basic_tab.get(), server->TestServerPageW(L"auth-basic")); |
115 | 116 |
116 AppendTab(GURL("about:blank")); | 117 AppendTab(GURL(chrome::kAboutBlankURL)); |
117 scoped_refptr<TabProxy> digest_tab(GetActiveTabProxy()); | 118 scoped_refptr<TabProxy> digest_tab(GetActiveTabProxy()); |
118 NavigateTab(digest_tab.get(), server->TestServerPageW(L"auth-digest")); | 119 NavigateTab(digest_tab.get(), server->TestServerPageW(L"auth-digest")); |
119 | 120 |
120 // TODO(devint): http://b/1158262 basic_tab is not active, so this logs in to | 121 // TODO(devint): http://b/1158262 basic_tab is not active, so this logs in to |
121 // a page whose tab isn't active, which isn't actually possible for the user | 122 // a page whose tab isn't active, which isn't actually possible for the user |
122 // to do. I had a fix for this, but I'm reverting it to see if it makes the | 123 // to do. I had a fix for this, but I'm reverting it to see if it makes the |
123 // test less flaky. | 124 // test less flaky. |
124 EXPECT_TRUE(basic_tab->NeedsAuth()); | 125 EXPECT_TRUE(basic_tab->NeedsAuth()); |
125 EXPECT_TRUE(basic_tab->SetAuth(username_basic_, password_)); | 126 EXPECT_TRUE(basic_tab->SetAuth(username_basic_, password_)); |
126 EXPECT_TRUE(digest_tab->NeedsAuth()); | 127 EXPECT_TRUE(digest_tab->NeedsAuth()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 EXPECT_TRUE(tab->GoForward()); // should bring us to 'c' | 165 EXPECT_TRUE(tab->GoForward()); // should bring us to 'c' |
165 EXPECT_FALSE(tab->NeedsAuth()); | 166 EXPECT_FALSE(tab->NeedsAuth()); |
166 | 167 |
167 // Now test that cancelling works as expected. | 168 // Now test that cancelling works as expected. |
168 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic")); | 169 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic")); |
169 EXPECT_TRUE(tab->NeedsAuth()); | 170 EXPECT_TRUE(tab->NeedsAuth()); |
170 EXPECT_TRUE(tab->CancelAuth()); | 171 EXPECT_TRUE(tab->CancelAuth()); |
171 EXPECT_FALSE(tab->NeedsAuth()); | 172 EXPECT_FALSE(tab->NeedsAuth()); |
172 EXPECT_EQ(L"Denied: no auth", GetActiveTabTitle()); | 173 EXPECT_EQ(L"Denied: no auth", GetActiveTabTitle()); |
173 } | 174 } |
OLD | NEW |