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

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

Issue 2849713003: Move all Page Info strings into page_info_strings.grdp (Closed)
Patch Set: Fix moar. Created 3 years, 7 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 84 NSString* expectedText =
85 [NSString stringWithFormat:@"%@ %@", 85 [NSString stringWithFormat:@"%@ %@",
86 l10n_util::GetNSStringF( 86 l10n_util::GetNSStringF(
87 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 87 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
88 base::SysNSStringToUTF16(kTestHost)), 88 base::SysNSStringToUTF16(kTestHost)),
89 l10n_util::GetNSString( 89 l10n_util::GetNSString(
90 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)]; 90 IDS_PAGE_INFO_NOT_SECURE_SUMMARY)];
91 91
92 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 92 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
93 } 93 }
94 94
95 // Tests showing the dialog for http proxy server. 95 // Tests showing the dialog for http proxy server.
96 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) { 96 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) {
97 NSURLProtectionSpace* protectionSpace = 97 NSURLProtectionSpace* protectionSpace =
98 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPProxy); 98 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPProxy);
99 99
100 ASSERT_TRUE(CanShow(protectionSpace)); 100 ASSERT_TRUE(CanShow(protectionSpace));
101 101
102 // Expecting the following text: 102 // Expecting the following text:
103 // The proxy http://chromium.org requires a username and password. 103 // The proxy http://chromium.org requires a username and password.
104 // Your connection to this site is not private. 104 // Your connection to this site is not private.
105 NSString* expectedText = 105 NSString* expectedText =
106 [NSString stringWithFormat:@"%@ %@", 106 [NSString stringWithFormat:@"%@ %@",
107 l10n_util::GetNSStringF( 107 l10n_util::GetNSStringF(
108 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 108 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
109 base::SysNSStringToUTF16(kTestHttpOrigin)), 109 base::SysNSStringToUTF16(kTestHttpOrigin)),
110 l10n_util::GetNSString( 110 l10n_util::GetNSString(
111 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)]; 111 IDS_PAGE_INFO_NOT_SECURE_SUMMARY)];
112 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 112 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
113 } 113 }
114 114
115 // Tests showing the dialog for https proxy server. 115 // Tests showing the dialog for https proxy server.
116 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) { 116 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) {
117 NSURLProtectionSpace* protectionSpace = 117 NSURLProtectionSpace* protectionSpace =
118 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPSProxy); 118 GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPSProxy);
119 119
120 ASSERT_TRUE(CanShow(protectionSpace)); 120 ASSERT_TRUE(CanShow(protectionSpace));
121 121
122 NSString* expectedText = nil; 122 NSString* expectedText = nil;
123 // On iOS 10, HTTPS Proxy protection space reports itself as unsecure 123 // On iOS 10, HTTPS Proxy protection space reports itself as unsecure
124 // (crbug.com/629570). 124 // (crbug.com/629570).
125 if (base::ios::IsRunningOnIOS10OrLater()) { 125 if (base::ios::IsRunningOnIOS10OrLater()) {
126 // Expecting the following text: 126 // Expecting the following text:
127 // The proxy https://chromium.org requires a username and password. 127 // The proxy https://chromium.org requires a username and password.
128 // Your connection to this site is not private. 128 // Your connection to this site is not private.
129 expectedText = [NSString 129 expectedText = [NSString
130 stringWithFormat:@"%@ %@", 130 stringWithFormat:@"%@ %@",
131 l10n_util::GetNSStringF( 131 l10n_util::GetNSStringF(
132 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 132 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
133 base::SysNSStringToUTF16(kTestHttpsOrigin)), 133 base::SysNSStringToUTF16(kTestHttpsOrigin)),
134 l10n_util::GetNSString( 134 l10n_util::GetNSString(
135 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)]; 135 IDS_PAGE_INFO_NOT_SECURE_SUMMARY)];
136 } else { 136 } else {
137 // Expecting the following text: 137 // Expecting the following text:
138 // The proxy https://chromium.org:80 requires a username and password. 138 // The proxy https://chromium.org:80 requires a username and password.
139 expectedText = 139 expectedText =
140 l10n_util::GetNSStringF(IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 140 l10n_util::GetNSStringF(IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
141 base::SysNSStringToUTF16(kTestHttpsOrigin)); 141 base::SysNSStringToUTF16(kTestHttpsOrigin));
142 } 142 }
143 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 143 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
144 } 144 }
145 145
146 // Tests showing the dialog for http server. 146 // Tests showing the dialog for http server.
147 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) { 147 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) {
148 NSURLProtectionSpace* protectionSpace = 148 NSURLProtectionSpace* protectionSpace =
149 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTP); 149 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTP);
150 150
151 ASSERT_TRUE(CanShow(protectionSpace)); 151 ASSERT_TRUE(CanShow(protectionSpace));
152 152
153 // Expecting the following text: 153 // Expecting the following text:
154 // http://chromium.org requires a username and password. 154 // http://chromium.org requires a username and password.
155 NSString* expectedText = 155 NSString* expectedText =
156 [NSString stringWithFormat:@"%@ %@", 156 [NSString stringWithFormat:@"%@ %@",
157 l10n_util::GetNSStringF( 157 l10n_util::GetNSStringF(
158 IDS_LOGIN_DIALOG_AUTHORITY, 158 IDS_LOGIN_DIALOG_AUTHORITY,
159 base::SysNSStringToUTF16(kTestHttpOrigin)), 159 base::SysNSStringToUTF16(kTestHttpOrigin)),
160 l10n_util::GetNSString( 160 l10n_util::GetNSString(
161 IDS_PAGE_INFO_NON_SECURE_TRANSPORT)]; 161 IDS_PAGE_INFO_NOT_SECURE_SUMMARY)];
162 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 162 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
163 } 163 }
164 164
165 // Tests showing the dialog for https server. 165 // Tests showing the dialog for https server.
166 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) { 166 TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) {
167 NSURLProtectionSpace* protectionSpace = 167 NSURLProtectionSpace* protectionSpace =
168 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS); 168 GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS);
169 169
170 ASSERT_TRUE(CanShow(protectionSpace)); 170 ASSERT_TRUE(CanShow(protectionSpace));
171 171
172 // Expecting the following text: 172 // Expecting the following text:
173 // https://chromium.org:80 requires a username and password. 173 // https://chromium.org:80 requires a username and password.
174 NSString* expectedText = l10n_util::GetNSStringF( 174 NSString* expectedText = l10n_util::GetNSStringF(
175 IDS_LOGIN_DIALOG_AUTHORITY, base::SysNSStringToUTF16(kTestHttpsOrigin)); 175 IDS_LOGIN_DIALOG_AUTHORITY, base::SysNSStringToUTF16(kTestHttpsOrigin));
176 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace)); 176 EXPECT_NSEQ(expectedText, MessageForHTTPAuth(protectionSpace));
177 } 177 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/dialogs/nsurl_protection_space_util.mm ('k') | ios/chrome/browser/ui/omnibox/page_info_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698