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

Side by Side Diff: extensions/browser/management_policy_unittest.cc

Issue 112963005: Update uses of UTF conversions in courgette/, device/, extensions/, google_apis/, gpu/, ipc/, media… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « extensions/browser/admin_policy.cc ('k') | extensions/browser/test_management_policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "extensions/browser/management_policy.h" 6 #include "extensions/browser/management_policy.h"
7 #include "extensions/browser/test_management_policy.h" 7 #include "extensions/browser/test_management_policy.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 typedef extensions::TestManagementPolicyProvider TestProvider; 10 typedef extensions::TestManagementPolicyProvider TestProvider;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 policy_.UnregisterProvider(&must_remain_disabled_); 173 policy_.UnregisterProvider(&must_remain_disabled_);
174 error.clear(); 174 error.clear();
175 EXPECT_FALSE(policy_.MustRemainDisabled(NULL, NULL, &error)); 175 EXPECT_FALSE(policy_.MustRemainDisabled(NULL, NULL, &error));
176 EXPECT_TRUE(error.empty()); 176 EXPECT_TRUE(error.empty());
177 } 177 }
178 178
179 // Tests error handling in the ManagementPolicy. 179 // Tests error handling in the ManagementPolicy.
180 TEST_F(ManagementPolicyTest, ErrorHandling) { 180 TEST_F(ManagementPolicyTest, ErrorHandling) {
181 // The error parameter should be unchanged if no restriction was found. 181 // The error parameter should be unchanged if no restriction was found.
182 std::string original_error = "Ceci est en effet une erreur."; 182 std::string original_error = "Ceci est en effet une erreur.";
183 base::string16 original_error16 = UTF8ToUTF16(original_error); 183 base::string16 original_error16 = base::UTF8ToUTF16(original_error);
184 base::string16 error = original_error16; 184 base::string16 error = original_error16;
185 EXPECT_TRUE(policy_.UserMayLoad(NULL, &error)); 185 EXPECT_TRUE(policy_.UserMayLoad(NULL, &error));
186 EXPECT_EQ(original_error, UTF16ToUTF8(error)); 186 EXPECT_EQ(original_error, base::UTF16ToUTF8(error));
187 EXPECT_TRUE(policy_.UserMayModifySettings(NULL, &error)); 187 EXPECT_TRUE(policy_.UserMayModifySettings(NULL, &error));
188 EXPECT_EQ(original_error, UTF16ToUTF8(error)); 188 EXPECT_EQ(original_error, base::UTF16ToUTF8(error));
189 EXPECT_FALSE(policy_.MustRemainEnabled(NULL, &error)); 189 EXPECT_FALSE(policy_.MustRemainEnabled(NULL, &error));
190 EXPECT_EQ(original_error, UTF16ToUTF8(error)); 190 EXPECT_EQ(original_error, base::UTF16ToUTF8(error));
191 191
192 // Ensure no crashes if no error message was requested. 192 // Ensure no crashes if no error message was requested.
193 EXPECT_TRUE(policy_.UserMayLoad(NULL, NULL)); 193 EXPECT_TRUE(policy_.UserMayLoad(NULL, NULL));
194 EXPECT_TRUE(policy_.UserMayModifySettings(NULL, NULL)); 194 EXPECT_TRUE(policy_.UserMayModifySettings(NULL, NULL));
195 EXPECT_FALSE(policy_.MustRemainEnabled(NULL, NULL)); 195 EXPECT_FALSE(policy_.MustRemainEnabled(NULL, NULL));
196 policy_.RegisterProvider(&restrict_all_); 196 policy_.RegisterProvider(&restrict_all_);
197 EXPECT_FALSE(policy_.UserMayLoad(NULL, NULL)); 197 EXPECT_FALSE(policy_.UserMayLoad(NULL, NULL));
198 EXPECT_FALSE(policy_.UserMayModifySettings(NULL, NULL)); 198 EXPECT_FALSE(policy_.UserMayModifySettings(NULL, NULL));
199 EXPECT_TRUE(policy_.MustRemainEnabled(NULL, NULL)); 199 EXPECT_TRUE(policy_.MustRemainEnabled(NULL, NULL));
200 200
201 // Make sure returned error is correct. 201 // Make sure returned error is correct.
202 error = original_error16; 202 error = original_error16;
203 EXPECT_FALSE(policy_.UserMayLoad(NULL, &error)); 203 EXPECT_FALSE(policy_.UserMayLoad(NULL, &error));
204 EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); 204 EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error);
205 error = original_error16; 205 error = original_error16;
206 EXPECT_FALSE(policy_.UserMayModifySettings(NULL, &error)); 206 EXPECT_FALSE(policy_.UserMayModifySettings(NULL, &error));
207 EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); 207 EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error);
208 error = original_error16; 208 error = original_error16;
209 EXPECT_TRUE(policy_.MustRemainEnabled(NULL, &error)); 209 EXPECT_TRUE(policy_.MustRemainEnabled(NULL, &error));
210 EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); 210 EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error);
211 } 211 }
OLDNEW
« no previous file with comments | « extensions/browser/admin_policy.cc ('k') | extensions/browser/test_management_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698