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

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

Issue 164391: Implement http auth login dialog for OS X. (Closed)
Patch Set: re-disable nonfuntional test Created 11 years, 4 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) 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/test/automation/tab_proxy.h" 9 #include "chrome/test/automation/tab_proxy.h"
10 #include "chrome/test/automation/browser_proxy.h" 10 #include "chrome/test/automation/browser_proxy.h"
11 #include "chrome/test/ui/ui_test.h" 11 #include "chrome/test/ui/ui_test.h"
12 #include "net/url_request/url_request_unittest.h" 12 #include "net/url_request/url_request_unittest.h"
13 13
14 using std::wstring; 14 using std::wstring;
15 15
16 namespace { 16 namespace {
17 17
18 const wchar_t kDocRoot[] = L"chrome/test/data"; 18 const wchar_t kDocRoot[] = L"chrome/test/data";
19 19
20 } // namespace
21
20 class LoginPromptTest : public UITest { 22 class LoginPromptTest : public UITest {
21 protected: 23 protected:
22 LoginPromptTest() 24 LoginPromptTest()
23 : UITest(), 25 : UITest(),
24 username_basic_(L"basicuser"), 26 username_basic_(L"basicuser"),
25 username_digest_(L"digestuser"), 27 username_digest_(L"digestuser"),
26 password_(L"secret"), 28 password_(L"secret"),
27 password_bad_(L"denyme") { 29 password_bad_(L"denyme") {
28 } 30 }
29 31
(...skipping 21 matching lines...) Expand all
51 wstring username_digest_; 53 wstring username_digest_;
52 wstring password_; 54 wstring password_;
53 wstring password_bad_; 55 wstring password_bad_;
54 }; 56 };
55 57
56 wstring ExpectedTitleFromAuth(wstring username, wstring password) { 58 wstring ExpectedTitleFromAuth(wstring username, wstring password) {
57 // The TestServer sets the title to username/password on successful login. 59 // The TestServer sets the title to username/password on successful login.
58 return username + L"/" + password; 60 return username + L"/" + password;
59 } 61 }
60 62
61 } // namespace
62
63 // Test that "Basic" HTTP authentication works. 63 // Test that "Basic" HTTP authentication works.
64 TEST_F(LoginPromptTest, TestBasicAuth) { 64 TEST_F(LoginPromptTest, TestBasicAuth) {
65 scoped_refptr<HTTPTestServer> server = 65 scoped_refptr<HTTPTestServer> server =
66 HTTPTestServer::CreateServer(kDocRoot, NULL); 66 HTTPTestServer::CreateServer(kDocRoot, NULL);
67 ASSERT_TRUE(NULL != server.get()); 67 ASSERT_TRUE(NULL != server.get());
68 scoped_refptr<TabProxy> tab(GetActiveTabProxy()); 68 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
69 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic")); 69 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
70 70
71 EXPECT_TRUE(tab->NeedsAuth()); 71 EXPECT_TRUE(tab->NeedsAuth());
72 EXPECT_FALSE(tab->SetAuth(username_basic_, password_bad_)); 72 EXPECT_FALSE(tab->SetAuth(username_basic_, password_bad_));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 EXPECT_TRUE(tab->GoForward()); // should bring us to 'c' 163 EXPECT_TRUE(tab->GoForward()); // should bring us to 'c'
164 EXPECT_FALSE(tab->NeedsAuth()); 164 EXPECT_FALSE(tab->NeedsAuth());
165 165
166 // Now test that cancelling works as expected. 166 // Now test that cancelling works as expected.
167 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic")); 167 NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
168 EXPECT_TRUE(tab->NeedsAuth()); 168 EXPECT_TRUE(tab->NeedsAuth());
169 EXPECT_TRUE(tab->CancelAuth()); 169 EXPECT_TRUE(tab->CancelAuth());
170 EXPECT_FALSE(tab->NeedsAuth()); 170 EXPECT_FALSE(tab->NeedsAuth());
171 EXPECT_EQ(L"Denied: no auth", GetActiveTabTitle()); 171 EXPECT_EQ(L"Denied: no auth", GetActiveTabTitle());
172 } 172 }
OLDNEW
« no previous file with comments | « chrome/browser/login_prompt_mac.mm ('k') | chrome/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698