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

Side by Side Diff: ios/chrome/browser/ui/dialogs/nsurl_protection_space_util_unittest.mm

Issue 2754383004: Rename WebsiteSettings code to PageInfo. (Closed)
Patch Set: Upload missing comment fix for WebSettingsUI -> PageInfoUI. Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/dialogs/nsurl_protection_space_util.h" 5 #import "ios/chrome/browser/ui/dialogs/nsurl_protection_space_util.h"
6 6
7 #include "base/ios/ios_util.h" 7 #include "base/ios/ios_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Tests showing the dialog for SOCKS proxy server. 74 // Tests showing the dialog for SOCKS proxy server.
75 TEST(NSURLProtectionSpaceUtilTest, ShowForSocksProxy) { 75 TEST(NSURLProtectionSpaceUtilTest, ShowForSocksProxy) {
76 NSURLProtectionSpace* protectionSpace = 76 NSURLProtectionSpace* protectionSpace =
77 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceSOCKSProxy); 77 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceSOCKSProxy);
78 78
79 ASSERT_TRUE(CanShow(protectionSpace)); 79 ASSERT_TRUE(CanShow(protectionSpace));
80 80
81 // Expecting the following text: 81 // Expecting the following text:
82 // The proxy chromium.org requires a username and password. 82 // The proxy chromium.org requires a username and password.
83 // Your connection to this site is not private. 83 // Your connection to this site is not private.
84 NSString* expectedText = [NSString 84 NSString* expectedText =
85 stringWithFormat:@"%@ %@", l10n_util::GetNSStringF( 85 [NSString stringWithFormat:@"%@ %@",
86 l10n_util::GetNSStringF(
86 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 87 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
87 base::SysNSStringToUTF16(kTestHost)), 88 base::SysNSStringToUTF16(kTestHost)),
88 l10n_util::GetNSString( 89 l10n_util::GetNSString(
89 IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)]; 90 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
90 91
91 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 92 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
92 } 93 }
93 94
94 // Tests showing the dialog for http proxy server. 95 // Tests showing the dialog for http proxy server.
95 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) { 96 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) {
96 NSURLProtectionSpace* protectionSpace = 97 NSURLProtectionSpace* protectionSpace =
97 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPProxy); 98 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPProxy);
98 99
99 ASSERT_TRUE(CanShow(protectionSpace)); 100 ASSERT_TRUE(CanShow(protectionSpace));
100 101
101 // Expecting the following text: 102 // Expecting the following text:
102 // The proxy http://chromium.org requires a username and password. 103 // The proxy http://chromium.org requires a username and password.
103 // Your connection to this site is not private. 104 // Your connection to this site is not private.
104 NSString* expectedText = [NSString 105 NSString* expectedText =
105 stringWithFormat:@"%@ %@", l10n_util::GetNSStringF( 106 [NSString stringWithFormat:@"%@ %@",
107 l10n_util::GetNSStringF(
106 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 108 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
107 base::SysNSStringToUTF16(kTestHttpOrigin)), 109 base::SysNSStringToUTF16(kTestHttpOrigin)),
108 l10n_util::GetNSString( 110 l10n_util::GetNSString(
109 IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)]; 111 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
110 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 112 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
111 } 113 }
112 114
113 // Tests showing the dialog for https proxy server. 115 // Tests showing the dialog for https proxy server.
114 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) { 116 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) {
115 NSURLProtectionSpace* protectionSpace = 117 NSURLProtectionSpace* protectionSpace =
116 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPSProxy); 118 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPSProxy);
117 119
118 ASSERT_TRUE(CanShow(protectionSpace)); 120 ASSERT_TRUE(CanShow(protectionSpace));
119 121
120 NSString* expectedText = nil; 122 NSString* expectedText = nil;
121 // On iOS 10, HTTPS Proxy protection space reports itself as unsecure 123 // On iOS 10, HTTPS Proxy protection space reports itself as unsecure
122 // (crbug.com/629570). 124 // (crbug.com/629570).
123 if (base::ios::IsRunningOnIOS10OrLater()) { 125 if (base::ios::IsRunningOnIOS10OrLater()) {
124 // Expecting the following text: 126 // Expecting the following text:
125 // The proxy https://chromium.org requires a username and password. 127 // The proxy https://chromium.org requires a username and password.
126 // Your connection to this site is not private. 128 // Your connection to this site is not private.
127 expectedText = [NSString 129 expectedText = [NSString
128 stringWithFormat:@"%@ %@", 130 stringWithFormat:@"%@ %@",
129 l10n_util::GetNSStringF( 131 l10n_util::GetNSStringF(
130 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 132 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
131 base::SysNSStringToUTF16(kTestHttpsOrigin)), 133 base::SysNSStringToUTF16(kTestHttpsOrigin)),
132 l10n_util::GetNSString( 134 l10n_util::GetNSString(
133 IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)]; 135 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
134 } else { 136 } else {
135 // Expecting the following text: 137 // Expecting the following text:
136 // The proxy https://chromium.org:80 requires a username and password. 138 // The proxy https://chromium.org:80 requires a username and password.
137 expectedText = 139 expectedText =
138 l10n_util::GetNSStringF(IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 140 l10n_util::GetNSStringF(IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
139 base::SysNSStringToUTF16(kTestHttpsOrigin)); 141 base::SysNSStringToUTF16(kTestHttpsOrigin));
140 } 142 }
141 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 143 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
142 } 144 }
143 145
144 // Tests showing the dialog for http server. 146 // Tests showing the dialog for http server.
145 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) { 147 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) {
146 NSURLProtectionSpace* protectionSpace = 148 NSURLProtectionSpace* protectionSpace =
147 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTP); 149 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTP);
148 150
149 ASSERT_TRUE(CanShow(protectionSpace)); 151 ASSERT_TRUE(CanShow(protectionSpace));
150 152
151 // Expecting the following text: 153 // Expecting the following text:
152 // http://chromium.org requires a username and password. 154 // http://chromium.org requires a username and password.
153 NSString* expectedText = [NSString 155 NSString* expectedText =
154 stringWithFormat:@"%@ %@", l10n_util::GetNSStringF( 156 [NSString stringWithFormat:@"%@ %@",
157 l10n_util::GetNSStringF(
155 IDS_LOGIN_DIALOG_AUTHORITY, 158 IDS_LOGIN_DIALOG_AUTHORITY,
156 base::SysNSStringToUTF16(kTestHttpOrigin)), 159 base::SysNSStringToUTF16(kTestHttpOrigin)),
157 l10n_util::GetNSString( 160 l10n_util::GetNSString(
158 IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT)]; 161 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)];
159 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 162 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
160 } 163 }
161 164
162 // Tests showing the dialog for https server. 165 // Tests showing the dialog for https server.
163 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) { 166 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) {
164 NSURLProtectionSpace* protectionSpace = 167 NSURLProtectionSpace* protectionSpace =
165 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS); 168 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS);
166 169
167 ASSERT_TRUE(CanShow(protectionSpace)); 170 ASSERT_TRUE(CanShow(protectionSpace));
168 171
169 // Expecting the following text: 172 // Expecting the following text:
170 // https://chromium.org:80 requires a username and password. 173 // https://chromium.org:80 requires a username and password.
171 NSString* expectedText = l10n_util::GetNSStringF( 174 NSString* expectedText = l10n_util::GetNSStringF(
172 IDS_LOGIN_DIALOG_AUTHORITY, base::SysNSStringToUTF16(kTestHttpsOrigin)); 175 IDS_LOGIN_DIALOG_AUTHORITY, base::SysNSStringToUTF16(kTestHttpsOrigin));
173 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 176 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
174 } 177 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/dialogs/nsurl_protection_space_util.mm ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698