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

Side by Side Diff: remoting/host/setup/native_messaging_host_unittest.cc

Issue 16236008: Send enums as strings between Chromoting Native Messaging host and web-app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 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 | « remoting/host/setup/native_messaging_host.cc ('k') | remoting/webapp/host_native_messaging.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_messaging_host.h" 5 #include "remoting/host/setup/native_messaging_host.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 EXPECT_TRUE(supported); 78 EXPECT_TRUE(supported);
79 EXPECT_TRUE(allowed); 79 EXPECT_TRUE(allowed);
80 EXPECT_TRUE(set_by_policy); 80 EXPECT_TRUE(set_by_policy);
81 } 81 }
82 82
83 void VerifyStopDaemonResponse(const base::DictionaryValue* response) { 83 void VerifyStopDaemonResponse(const base::DictionaryValue* response) {
84 ASSERT_TRUE(response); 84 ASSERT_TRUE(response);
85 std::string value; 85 std::string value;
86 EXPECT_TRUE(response->GetString("type", &value)); 86 EXPECT_TRUE(response->GetString("type", &value));
87 EXPECT_EQ("stopDaemonResponse", value); 87 EXPECT_EQ("stopDaemonResponse", value);
88 int result; 88 EXPECT_TRUE(response->GetString("result", &value));
89 EXPECT_TRUE(response->GetInteger("result", &result)); 89 EXPECT_EQ("OK", value);
90 EXPECT_EQ(0, result);
91 } 90 }
92 91
93 void VerifyGetDaemonStateResponse(const base::DictionaryValue* response) { 92 void VerifyGetDaemonStateResponse(const base::DictionaryValue* response) {
94 ASSERT_TRUE(response); 93 ASSERT_TRUE(response);
95 std::string value; 94 std::string value;
96 EXPECT_TRUE(response->GetString("type", &value)); 95 EXPECT_TRUE(response->GetString("type", &value));
97 EXPECT_EQ("getDaemonStateResponse", value); 96 EXPECT_EQ("getDaemonStateResponse", value);
98 int result; 97 EXPECT_TRUE(response->GetString("state", &value));
99 EXPECT_TRUE(response->GetInteger("state", &result)); 98 EXPECT_EQ("STARTED", value);
100 EXPECT_EQ(4, result);
101 } 99 }
102 100
103 void VerifyUpdateDaemonConfigResponse(const base::DictionaryValue* response) { 101 void VerifyUpdateDaemonConfigResponse(const base::DictionaryValue* response) {
104 ASSERT_TRUE(response); 102 ASSERT_TRUE(response);
105 std::string value; 103 std::string value;
106 EXPECT_TRUE(response->GetString("type", &value)); 104 EXPECT_TRUE(response->GetString("type", &value));
107 EXPECT_EQ("updateDaemonConfigResponse", value); 105 EXPECT_EQ("updateDaemonConfigResponse", value);
108 int result; 106 EXPECT_TRUE(response->GetString("result", &value));
109 EXPECT_TRUE(response->GetInteger("result", &result)); 107 EXPECT_EQ("OK", value);
110 EXPECT_EQ(0, result);
111 } 108 }
112 109
113 void VerifyStartDaemonResponse(const base::DictionaryValue* response) { 110 void VerifyStartDaemonResponse(const base::DictionaryValue* response) {
114 ASSERT_TRUE(response); 111 ASSERT_TRUE(response);
115 std::string value; 112 std::string value;
116 EXPECT_TRUE(response->GetString("type", &value)); 113 EXPECT_TRUE(response->GetString("type", &value));
117 EXPECT_EQ("startDaemonResponse", value); 114 EXPECT_EQ("startDaemonResponse", value);
118 int result; 115 EXPECT_TRUE(response->GetString("result", &value));
119 EXPECT_TRUE(response->GetInteger("result", &result)); 116 EXPECT_EQ("OK", value);
120 EXPECT_EQ(0, result);
121 } 117 }
122 118
123 } // namespace 119 } // namespace
124 120
125 namespace remoting { 121 namespace remoting {
126 122
127 class MockDaemonController : public DaemonController { 123 class MockDaemonController : public DaemonController {
128 public: 124 public:
129 MockDaemonController(); 125 MockDaemonController();
130 virtual ~MockDaemonController(); 126 virtual ~MockDaemonController();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 504
509 // Verify rejection if startDaemon request has no "consent" parameter. 505 // Verify rejection if startDaemon request has no "consent" parameter.
510 TEST_F(NativeMessagingHostTest, StartDaemonNoConsent) { 506 TEST_F(NativeMessagingHostTest, StartDaemonNoConsent) {
511 base::DictionaryValue message; 507 base::DictionaryValue message;
512 message.SetString("type", "startDaemon"); 508 message.SetString("type", "startDaemon");
513 message.Set("config", base::DictionaryValue().DeepCopy()); 509 message.Set("config", base::DictionaryValue().DeepCopy());
514 TestBadRequest(message); 510 TestBadRequest(message);
515 } 511 }
516 512
517 } // namespace remoting 513 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/native_messaging_host.cc ('k') | remoting/webapp/host_native_messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698