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

Side by Side Diff: components/copresence/rpc/rpc_handler_unittest.cc

Issue 460743004: Improve audible token detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « components/copresence/rpc/rpc_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/copresence/rpc/rpc_handler.h" 5 #include "components/copresence/rpc/rpc_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 report->header().client_version().client()); 259 report->header().client_version().client());
260 EXPECT_EQ("CreateRequestHeader Device ID", 260 EXPECT_EQ("CreateRequestHeader Device ID",
261 report->header().registered_device_id()); 261 report->header().registered_device_id());
262 } 262 }
263 263
264 // TODO(ckehoe): Renable these after https://codereview.chromium.org/453203002/ 264 // TODO(ckehoe): Renable these after https://codereview.chromium.org/453203002/
265 // lands. 265 // lands.
266 #define MAYBE_ReportTokens DISABLED_ReportTokens 266 #define MAYBE_ReportTokens DISABLED_ReportTokens
267 267
268 TEST_F(RpcHandlerTest, MAYBE_ReportTokens) { 268 TEST_F(RpcHandlerTest, MAYBE_ReportTokens) {
269 std::vector<std::string> test_tokens; 269 std::vector<FullToken> test_tokens;
270 test_tokens.push_back("token 1"); 270 test_tokens.push_back(FullToken("token 1", false));
271 test_tokens.push_back("token 2"); 271 test_tokens.push_back(FullToken("token 2", true));
272 test_tokens.push_back("token 3"); 272 test_tokens.push_back(FullToken("token 3", false));
273 AddInvalidToken("token 2"); 273 AddInvalidToken("token 2");
274 274
275 rpc_handler_.ReportTokens(AUDIO_ULTRASOUND_PASSBAND, test_tokens); 275 rpc_handler_.ReportTokens(test_tokens);
276 EXPECT_EQ(RpcHandler::kReportRequestRpcName, rpc_name_); 276 EXPECT_EQ(RpcHandler::kReportRequestRpcName, rpc_name_);
277 ReportRequest* report = static_cast<ReportRequest*>(request_proto_.get()); 277 ReportRequest* report = static_cast<ReportRequest*>(request_proto_.get());
278 google::protobuf::RepeatedPtrField<TokenObservation> tokens_sent = 278 google::protobuf::RepeatedPtrField<TokenObservation> tokens_sent =
279 report->update_signals_request().token_observation(); 279 report->update_signals_request().token_observation();
280 ASSERT_EQ(2, tokens_sent.size()); 280 ASSERT_EQ(2, tokens_sent.size());
281 EXPECT_EQ("token 1", tokens_sent.Get(0).token_id()); 281 EXPECT_EQ("token 1", tokens_sent.Get(0).token_id());
282 EXPECT_EQ("token 3", tokens_sent.Get(1).token_id()); 282 EXPECT_EQ("token 3", tokens_sent.Get(1).token_id());
283 } 283 }
284 284
285 // TODO(ckehoe): Renable these after https://codereview.chromium.org/453203002/ 285 // TODO(ckehoe): Renable these after https://codereview.chromium.org/453203002/
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 messages_by_subscription_["Subscription 2"][1].payload()); 341 messages_by_subscription_["Subscription 2"][1].payload());
342 342
343 ASSERT_EQ(2U, directive_handler->added_directives().size()); 343 ASSERT_EQ(2U, directive_handler->added_directives().size());
344 EXPECT_EQ("Subscription 1", 344 EXPECT_EQ("Subscription 1",
345 directive_handler->added_directives()[0].subscription_id()); 345 directive_handler->added_directives()[0].subscription_id());
346 EXPECT_EQ("Subscription 2", 346 EXPECT_EQ("Subscription 2",
347 directive_handler->added_directives()[1].subscription_id()); 347 directive_handler->added_directives()[1].subscription_id());
348 } 348 }
349 349
350 } // namespace copresence 350 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/rpc/rpc_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698