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 "remoting/host/setup/me2me_native_messaging_host.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 message.SetString("type", "stopDaemon"); | 491 message.SetString("type", "stopDaemon"); |
492 WriteMessageToInputPipe(message); | 492 WriteMessageToInputPipe(message); |
493 | 493 |
494 message.SetInteger("id", next_id++); | 494 message.SetInteger("id", next_id++); |
495 message.SetString("type", "getDaemonState"); | 495 message.SetString("type", "getDaemonState"); |
496 WriteMessageToInputPipe(message); | 496 WriteMessageToInputPipe(message); |
497 | 497 |
498 // Following messages require a "config" dictionary. | 498 // Following messages require a "config" dictionary. |
499 base::DictionaryValue config; | 499 base::DictionaryValue config; |
500 config.SetBoolean("update", true); | 500 config.SetBoolean("update", true); |
501 message.Set("config", config.DeepCopy()); | 501 message.Set("config", config.CreateDeepCopy()); |
502 message.SetInteger("id", next_id++); | 502 message.SetInteger("id", next_id++); |
503 message.SetString("type", "updateDaemonConfig"); | 503 message.SetString("type", "updateDaemonConfig"); |
504 WriteMessageToInputPipe(message); | 504 WriteMessageToInputPipe(message); |
505 | 505 |
506 config.Clear(); | 506 config.Clear(); |
507 config.SetBoolean("start", true); | 507 config.SetBoolean("start", true); |
508 message.Set("config", config.DeepCopy()); | 508 message.Set("config", config.CreateDeepCopy()); |
509 message.SetBoolean("consent", true); | 509 message.SetBoolean("consent", true); |
510 message.SetInteger("id", next_id++); | 510 message.SetInteger("id", next_id++); |
511 message.SetString("type", "startDaemon"); | 511 message.SetString("type", "startDaemon"); |
512 WriteMessageToInputPipe(message); | 512 WriteMessageToInputPipe(message); |
513 | 513 |
514 message.SetInteger("id", next_id++); | 514 message.SetInteger("id", next_id++); |
515 message.SetString("type", "getCredentialsFromAuthCode"); | 515 message.SetString("type", "getCredentialsFromAuthCode"); |
516 message.SetString("authorizationCode", "fake_auth_code"); | 516 message.SetString("authorizationCode", "fake_auth_code"); |
517 WriteMessageToInputPipe(message); | 517 WriteMessageToInputPipe(message); |
518 | 518 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 message.SetString("type", "startDaemon"); | 618 message.SetString("type", "startDaemon"); |
619 message.SetString("config", "xxx"); | 619 message.SetString("config", "xxx"); |
620 message.SetBoolean("consent", true); | 620 message.SetBoolean("consent", true); |
621 TestBadRequest(message); | 621 TestBadRequest(message); |
622 } | 622 } |
623 | 623 |
624 // Verify rejection if startDaemon request has no "consent" parameter. | 624 // Verify rejection if startDaemon request has no "consent" parameter. |
625 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) { | 625 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) { |
626 base::DictionaryValue message; | 626 base::DictionaryValue message; |
627 message.SetString("type", "startDaemon"); | 627 message.SetString("type", "startDaemon"); |
628 message.Set("config", base::DictionaryValue().DeepCopy()); | 628 message.Set("config", base::DictionaryValue().CreateDeepCopy()); |
629 TestBadRequest(message); | 629 TestBadRequest(message); |
630 } | 630 } |
631 | 631 |
632 // Verify rejection if getCredentialsFromAuthCode has no auth code. | 632 // Verify rejection if getCredentialsFromAuthCode has no auth code. |
633 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { | 633 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { |
634 base::DictionaryValue message; | 634 base::DictionaryValue message; |
635 message.SetString("type", "getCredentialsFromAuthCode"); | 635 message.SetString("type", "getCredentialsFromAuthCode"); |
636 TestBadRequest(message); | 636 TestBadRequest(message); |
637 } | 637 } |
638 | 638 |
639 } // namespace remoting | 639 } // namespace remoting |
OLD | NEW |