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

Side by Side Diff: components/gcm_driver/instance_id/instance_id_driver_unittest.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 #include "components/gcm_driver/instance_id/instance_id_driver.h" 5 #include "components/gcm_driver/instance_id/instance_id_driver.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 14 matching lines...) Expand all
25 const char kScope2[] = "FooBar"; 25 const char kScope2[] = "FooBar";
26 26
27 bool VerifyInstanceID(const std::string& str) { 27 bool VerifyInstanceID(const std::string& str) {
28 // Checks the length. 28 // Checks the length.
29 if (str.length() != static_cast<size_t>( 29 if (str.length() != static_cast<size_t>(
30 std::ceil(InstanceID::kInstanceIDByteLength * 8 / 6.0))) 30 std::ceil(InstanceID::kInstanceIDByteLength * 8 / 6.0)))
31 return false; 31 return false;
32 32
33 // Checks if it is URL-safe base64 encoded. 33 // Checks if it is URL-safe base64 encoded.
34 for (auto ch : str) { 34 for (auto ch : str) {
35 if (!IsAsciiAlpha(ch) && !IsAsciiDigit(ch) && ch != '_' && ch != '-') 35 if (!base::IsAsciiAlpha(ch) && !base::IsAsciiDigit(ch) &&
36 ch != '_' && ch != '-')
36 return false; 37 return false;
37 } 38 }
38 return true; 39 return true;
39 } 40 }
40 41
41 } // namespace 42 } // namespace
42 43
43 class InstanceIDDriverTest : public testing::Test { 44 class InstanceIDDriverTest : public testing::Test {
44 public: 45 public:
45 InstanceIDDriverTest(); 46 InstanceIDDriverTest();
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 GetToken(instance_id, kAuthorizedEntity1, kScope2, options); 347 GetToken(instance_id, kAuthorizedEntity1, kScope2, options);
347 EXPECT_FALSE(new_token1.empty()); 348 EXPECT_FALSE(new_token1.empty());
348 EXPECT_NE(token1, new_token1); 349 EXPECT_NE(token1, new_token1);
349 350
350 // The other token is not affected by the deletion. 351 // The other token is not affected by the deletion.
351 EXPECT_EQ(token2, 352 EXPECT_EQ(token2,
352 GetToken(instance_id, kAuthorizedEntity2, kScope1, options)); 353 GetToken(instance_id, kAuthorizedEntity2, kScope1, options));
353 } 354 }
354 355
355 } // instance_id 356 } // instance_id
OLDNEW
« no previous file with comments | « components/content_settings/core/common/content_settings_pattern_parser.cc ('k') | components/omnibox/history_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698