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

Side by Side Diff: components/gcm_driver/gcm_account_tracker_unittest.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gcm_account_tracker.h" 5 #include "components/gcm_driver/gcm_account_tracker.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "components/gcm_driver/fake_gcm_driver.h" 11 #include "components/gcm_driver/fake_gcm_driver.h"
12 #include "google_apis/gaia/fake_identity_provider.h" 12 #include "google_apis/gaia/fake_identity_provider.h"
13 #include "google_apis/gaia/fake_oauth2_token_service.h" 13 #include "google_apis/gaia/fake_oauth2_token_service.h"
14 #include "google_apis/gaia/google_service_auth_error.h" 14 #include "google_apis/gaia/google_service_auth_error.h"
15 #include "net/http/http_status_code.h" 15 #include "net/http/http_status_code.h"
16 #include "net/url_request/test_url_fetcher_factory.h" 16 #include "net/url_request/test_url_fetcher_factory.h"
17 #include "net/url_request/url_request_test_util.h" 17 #include "net/url_request/url_request_test_util.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace gcm { 20 namespace gcm {
21 21
22 namespace { 22 namespace {
23 23
24 const char kAccountId1[] = "account_1"; 24 const char kAccountId1[] = "account_1";
25 const char kAccountId2[] = "account_2"; 25 const char kAccountId2[] = "account_2";
26 26
27 std::string AccountKeyToObfuscatedId(const std::string email) { 27 std::string AccountKeyToObfuscatedId(const std::string& email) {
28 return "obfid-" + email; 28 return "obfid-" + email;
29 } 29 }
30 30
31 std::string GetValidTokenInfoResponse(const std::string account_key) { 31 std::string GetValidTokenInfoResponse(const std::string& account_key) {
32 return std::string("{ \"id\": \"") + AccountKeyToObfuscatedId(account_key) + 32 return std::string("{ \"id\": \"") + AccountKeyToObfuscatedId(account_key) +
33 "\" }"; 33 "\" }";
34 } 34 }
35 35
36 std::string MakeAccessToken(const std::string& account_key) { 36 std::string MakeAccessToken(const std::string& account_key) {
37 return "access_token-" + account_key; 37 return "access_token-" + account_key;
38 } 38 }
39 39
40 GCMClient::AccountTokenInfo MakeAccountToken(const std::string& account_key) { 40 GCMClient::AccountTokenInfo MakeAccountToken(const std::string& account_key) {
41 GCMClient::AccountTokenInfo token_info; 41 GCMClient::AccountTokenInfo token_info;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // but we have the update call. 511 // but we have the update call.
512 SignOutAccount(kAccountId1); 512 SignOutAccount(kAccountId1);
513 EXPECT_TRUE(driver()->update_accounts_called()); 513 EXPECT_TRUE(driver()->update_accounts_called());
514 EXPECT_FALSE(IsTokenReportingRequired()); 514 EXPECT_FALSE(IsTokenReportingRequired());
515 } 515 }
516 516
517 // TODO(fgorski): Add test for adding account after removal >> make sure it does 517 // TODO(fgorski): Add test for adding account after removal >> make sure it does
518 // not mark removal. 518 // not mark removal.
519 519
520 } // namespace gcm 520 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698