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

Side by Side Diff: components/supervised_user_error_page/supervised_user_error_page_unittest.cc

Issue 2739473006: Update supervised user interstitial pages. (Closed)
Patch Set: fix 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/supervised_user_error_page/supervised_user_error_page.h" 5 #include "components/supervised_user_error_page/supervised_user_error_page.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/grit/components_resources.h" 8 #include "components/grit/components_resources.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 22 matching lines...) Expand all
33 << "reason = " << param.reason 33 << "reason = " << param.reason
34 << " is_child_account = " << param.is_child_account 34 << " is_child_account = " << param.is_child_account
35 << " single parent = " << param.single_parent; 35 << " single parent = " << param.single_parent;
36 } 36 }
37 37
38 BlockMessageIDTestParameter block_message_id_test_params[] = { 38 BlockMessageIDTestParameter block_message_id_test_params[] = {
39 {DEFAULT, false, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT}, 39 {DEFAULT, false, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT},
40 {DEFAULT, false, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT}, 40 {DEFAULT, false, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT},
41 {DEFAULT, true, true, IDS_CHILD_BLOCK_MESSAGE_DEFAULT_SINGLE_PARENT}, 41 {DEFAULT, true, true, IDS_CHILD_BLOCK_MESSAGE_DEFAULT_SINGLE_PARENT},
42 {DEFAULT, true, false, IDS_CHILD_BLOCK_MESSAGE_DEFAULT_MULTI_PARENT}, 42 {DEFAULT, true, false, IDS_CHILD_BLOCK_MESSAGE_DEFAULT_MULTI_PARENT},
43 {ASYNC_CHECKER, false, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES}, 43 // SafeSites is not enabled for supervised users.
44 {ASYNC_CHECKER, false, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES},
45 {ASYNC_CHECKER, true, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES}, 44 {ASYNC_CHECKER, true, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES},
46 {ASYNC_CHECKER, true, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES}, 45 {ASYNC_CHECKER, true, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES},
47 {MANUAL, false, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL}, 46 {MANUAL, false, false, IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL},
48 {MANUAL, false, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL}, 47 {MANUAL, false, true, IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL},
49 {MANUAL, true, true, IDS_CHILD_BLOCK_MESSAGE_MANUAL_SINGLE_PARENT}, 48 {MANUAL, true, true, IDS_CHILD_BLOCK_MESSAGE_MANUAL_SINGLE_PARENT},
50 {MANUAL, true, false, IDS_CHILD_BLOCK_MESSAGE_MANUAL_MULTI_PARENT}, 49 {MANUAL, true, false, IDS_CHILD_BLOCK_MESSAGE_MANUAL_MULTI_PARENT},
51 }; 50 };
52 51
53 INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized, 52 INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized,
54 SupervisedUserErrorPageTest_GetBlockMessageID, 53 SupervisedUserErrorPageTest_GetBlockMessageID,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 .as_string(); 85 .as_string();
87 EXPECT_THAT(result, testing::HasSubstr(html)); 86 EXPECT_THAT(result, testing::HasSubstr(html));
88 EXPECT_THAT(result, testing::HasSubstr(param.profile_image_url)); 87 EXPECT_THAT(result, testing::HasSubstr(param.profile_image_url));
89 EXPECT_THAT(result, testing::HasSubstr(param.profile_image_url2)); 88 EXPECT_THAT(result, testing::HasSubstr(param.profile_image_url2));
90 EXPECT_THAT(result, testing::HasSubstr(param.custodian)); 89 EXPECT_THAT(result, testing::HasSubstr(param.custodian));
91 EXPECT_THAT(result, testing::HasSubstr(param.custodian_email)); 90 EXPECT_THAT(result, testing::HasSubstr(param.custodian_email));
92 if (param.has_two_parents) { 91 if (param.has_two_parents) {
93 EXPECT_THAT(result, testing::HasSubstr(param.second_custodian)); 92 EXPECT_THAT(result, testing::HasSubstr(param.second_custodian));
94 EXPECT_THAT(result, testing::HasSubstr(param.second_custodian_email)); 93 EXPECT_THAT(result, testing::HasSubstr(param.second_custodian_email));
95 } 94 }
96 #if defined(GOOGLE_CHROME_BUILD) 95 if (param.reason == ASYNC_CHECKER || param.reason == BLACKLIST) {
97 if (param.is_child_account &&
98 (param.reason == ASYNC_CHECKER || param.reason == BLACKLIST))
99 EXPECT_THAT(result, testing::HasSubstr("\"showFeedbackLink\":true")); 96 EXPECT_THAT(result, testing::HasSubstr("\"showFeedbackLink\":true"));
100 else 97 } else {
101 #endif
102 EXPECT_THAT(result, testing::HasSubstr("\"showFeedbackLink\":false")); 98 EXPECT_THAT(result, testing::HasSubstr("\"showFeedbackLink\":false"));
99 }
100
103 // Messages containing parameters aren't tested since they get modified before 101 // Messages containing parameters aren't tested since they get modified before
104 // they are added to the result. 102 // they are added to the result.
105 if (param.allow_access_requests) { 103 if (param.allow_access_requests) {
106 if (param.is_child_account) { 104 if (param.is_child_account) {
107 EXPECT_THAT(result, testing::HasSubstr(l10n_util::GetStringUTF8( 105 EXPECT_THAT(result, testing::HasSubstr(l10n_util::GetStringUTF8(
108 IDS_CHILD_BLOCK_INTERSTITIAL_HEADER))); 106 IDS_CHILD_BLOCK_INTERSTITIAL_HEADER)));
109 EXPECT_THAT(result, testing::HasSubstr(l10n_util::GetStringUTF8( 107 EXPECT_THAT(result, testing::HasSubstr(l10n_util::GetStringUTF8(
110 IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE))); 108 IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE)));
111 EXPECT_THAT( 109 EXPECT_THAT(
112 result, 110 result,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 BuildHtmlTestParameter build_html_test_parameter[] = { 192 BuildHtmlTestParameter build_html_test_parameter[] = {
195 {true, "url1", "url2", "custodian", "custodian_email", "", "", true, 193 {true, "url1", "url2", "custodian", "custodian_email", "", "", true,
196 DEFAULT, false}, 194 DEFAULT, false},
197 {true, "url1", "url2", "custodian", "custodian_email", "custodian2", 195 {true, "url1", "url2", "custodian", "custodian_email", "custodian2",
198 "custodian2_email", true, DEFAULT, true}, 196 "custodian2_email", true, DEFAULT, true},
199 {false, "url1", "url2", "custodian", "custodian_email", "custodian2", 197 {false, "url1", "url2", "custodian", "custodian_email", "custodian2",
200 "custodian2_email", true, DEFAULT, true}, 198 "custodian2_email", true, DEFAULT, true},
201 {true, "url1", "url2", "custodian", "custodian_email", "custodian2", 199 {true, "url1", "url2", "custodian", "custodian_email", "custodian2",
202 "custodian2_email", false, DEFAULT, true}, 200 "custodian2_email", false, DEFAULT, true},
203 {true, "url1", "url2", "custodian", "custodian_email", "custodian2", 201 {true, "url1", "url2", "custodian", "custodian_email", "custodian2",
204 "custodian2_email", false, ASYNC_CHECKER, true}, 202 "custodian2_email", true, ASYNC_CHECKER, true},
205 }; 203 };
206 204
207 INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized, 205 INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized,
208 SupervisedUserErrorPageTest_BuildHtml, 206 SupervisedUserErrorPageTest_BuildHtml,
209 ::testing::ValuesIn(build_html_test_parameter)); 207 ::testing::ValuesIn(build_html_test_parameter));
210 208
211 } // namespace supervised_user_error_page 209 } // namespace supervised_user_error_page
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698