OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A complete set of unit tests for OAuth2MintTokenFlow. | 5 // A complete set of unit tests for OAuth2MintTokenFlow. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 std::vector<std::string> CreateTestScopes() { | 104 std::vector<std::string> CreateTestScopes() { |
105 std::vector<std::string> scopes; | 105 std::vector<std::string> scopes; |
106 scopes.push_back("http://scope1"); | 106 scopes.push_back("http://scope1"); |
107 scopes.push_back("http://scope2"); | 107 scopes.push_back("http://scope2"); |
108 return scopes; | 108 return scopes; |
109 } | 109 } |
110 | 110 |
111 static IssueAdviceInfo CreateIssueAdvice() { | 111 static IssueAdviceInfo CreateIssueAdvice() { |
112 IssueAdviceInfo ia; | 112 IssueAdviceInfo ia; |
113 IssueAdviceInfoEntry e1; | 113 IssueAdviceInfoEntry e1; |
114 e1.description = ASCIIToUTF16("Manage your calendars"); | 114 e1.description = base::ASCIIToUTF16("Manage your calendars"); |
115 e1.details.push_back(ASCIIToUTF16("View and manage your calendars")); | 115 e1.details.push_back(base::ASCIIToUTF16("View and manage your calendars")); |
116 ia.push_back(e1); | 116 ia.push_back(e1); |
117 IssueAdviceInfoEntry e2; | 117 IssueAdviceInfoEntry e2; |
118 e2.description = ASCIIToUTF16("Manage your documents"); | 118 e2.description = base::ASCIIToUTF16("Manage your documents"); |
119 e2.details.push_back(ASCIIToUTF16("View your documents")); | 119 e2.details.push_back(base::ASCIIToUTF16("View your documents")); |
120 e2.details.push_back(ASCIIToUTF16("Upload new documents")); | 120 e2.details.push_back(base::ASCIIToUTF16("Upload new documents")); |
121 ia.push_back(e2); | 121 ia.push_back(e2); |
122 return ia; | 122 return ia; |
123 } | 123 } |
124 | 124 |
125 class MockDelegate : public OAuth2MintTokenFlow::Delegate { | 125 class MockDelegate : public OAuth2MintTokenFlow::Delegate { |
126 public: | 126 public: |
127 MockDelegate() {} | 127 MockDelegate() {} |
128 ~MockDelegate() {} | 128 ~MockDelegate() {} |
129 | 129 |
130 MOCK_METHOD2(OnMintTokenSuccess, void(const std::string& access_token, | 130 MOCK_METHOD2(OnMintTokenSuccess, void(const std::string& access_token, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 | 356 |
357 { // Non-null delegate. | 357 { // Non-null delegate. |
358 GoogleServiceAuthError error( | 358 GoogleServiceAuthError error( |
359 GoogleServiceAuthError::FromConnectionError(101)); | 359 GoogleServiceAuthError::FromConnectionError(101)); |
360 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); | 360 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); |
361 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); | 361 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); |
362 flow_->ProcessMintAccessTokenFailure(error); | 362 flow_->ProcessMintAccessTokenFailure(error); |
363 } | 363 } |
364 } | 364 } |
OLD | NEW |