| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "sync/test/accounts_client/test_accounts_client.cc" | 10 #include "sync/test/accounts_client/test_accounts_client.cc" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 EXPECT_FALSE(client.ClaimAccount(&session)); | 54 EXPECT_FALSE(client.ClaimAccount(&session)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TEST(TestAccountsClientTest, ClaimAccountSuccess) { | 57 TEST(TestAccountsClientTest, ClaimAccountSuccess) { |
| 58 vector<string> usernames; | 58 vector<string> usernames; |
| 59 usernames.push_back("foo0@gmail.com"); | 59 usernames.push_back("foo0@gmail.com"); |
| 60 usernames.push_back("foo1@gmail.com"); | 60 usernames.push_back("foo1@gmail.com"); |
| 61 usernames.push_back("foo2@gmail.com"); | 61 usernames.push_back("foo2@gmail.com"); |
| 62 NoNetworkTestAccountsClient client(kServer, kAccountSpace, usernames); | 62 NoNetworkTestAccountsClient client(kServer, kAccountSpace, usernames); |
| 63 | 63 |
| 64 DictionaryValue success_dict; | 64 base::DictionaryValue success_dict; |
| 65 success_dict.Set("username", new StringValue(kUsername)); | 65 success_dict.Set("username", new StringValue(kUsername)); |
| 66 success_dict.Set("account_space", new StringValue(kAccountSpace)); | 66 success_dict.Set("account_space", new StringValue(kAccountSpace)); |
| 67 success_dict.Set("session_id", new StringValue(kSessionId)); | 67 success_dict.Set("session_id", new StringValue(kSessionId)); |
| 68 success_dict.Set("expiration_time", new StringValue(kExpirationTime)); | 68 success_dict.Set("expiration_time", new StringValue(kExpirationTime)); |
| 69 | 69 |
| 70 string success_response; | 70 string success_response; |
| 71 base::JSONWriter::Write(&success_dict, &success_response); | 71 base::JSONWriter::Write(&success_dict, &success_response); |
| 72 EXPECT_CALL(client, SendRequest(_, _)) | 72 EXPECT_CALL(client, SendRequest(_, _)) |
| 73 .WillOnce(DoAll(SetArgPointee<1>(success_response), Return(true))); | 73 .WillOnce(DoAll(SetArgPointee<1>(success_response), Return(true))); |
| 74 | 74 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 TEST(TestAccountsClientTest, ReleaseAccountSuccess) { | 92 TEST(TestAccountsClientTest, ReleaseAccountSuccess) { |
| 93 vector<string> usernames; | 93 vector<string> usernames; |
| 94 NoNetworkTestAccountsClient client(kServer, kAccountSpace, usernames); | 94 NoNetworkTestAccountsClient client(kServer, kAccountSpace, usernames); |
| 95 EXPECT_CALL(client, SendRequest(_, _)) | 95 EXPECT_CALL(client, SendRequest(_, _)) |
| 96 .WillOnce(Return(true)); | 96 .WillOnce(Return(true)); |
| 97 AccountSession session = CreateValidAccountSession(); | 97 AccountSession session = CreateValidAccountSession(); |
| 98 client.ReleaseAccount(session); | 98 client.ReleaseAccount(session); |
| 99 } | 99 } |
| OLD | NEW |