| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 DaemonController::UsageStatsConsent consent; | 215 DaemonController::UsageStatsConsent consent; |
| 216 consent.supported = true; | 216 consent.supported = true; |
| 217 consent.allowed = true; | 217 consent.allowed = true; |
| 218 consent.set_by_policy = true; | 218 consent.set_by_policy = true; |
| 219 return consent; | 219 return consent; |
| 220 } | 220 } |
| 221 | 221 |
| 222 class Me2MeNativeMessagingHostTest : public testing::Test { | 222 class Me2MeNativeMessagingHostTest : public testing::Test { |
| 223 public: | 223 public: |
| 224 Me2MeNativeMessagingHostTest(); | 224 Me2MeNativeMessagingHostTest(); |
| 225 virtual ~Me2MeNativeMessagingHostTest(); | 225 ~Me2MeNativeMessagingHostTest() override; |
| 226 | 226 |
| 227 virtual void SetUp() override; | 227 void SetUp() override; |
| 228 virtual void TearDown() override; | 228 void TearDown() override; |
| 229 | 229 |
| 230 scoped_ptr<base::DictionaryValue> ReadMessageFromOutputPipe(); | 230 scoped_ptr<base::DictionaryValue> ReadMessageFromOutputPipe(); |
| 231 | 231 |
| 232 void WriteMessageToInputPipe(const base::Value& message); | 232 void WriteMessageToInputPipe(const base::Value& message); |
| 233 | 233 |
| 234 // The Host process should shut down when it receives a malformed request. | 234 // The Host process should shut down when it receives a malformed request. |
| 235 // This is tested by sending a known-good request, followed by |message|, | 235 // This is tested by sending a known-good request, followed by |message|, |
| 236 // followed by the known-good request again. The response file should only | 236 // followed by the known-good request again. The response file should only |
| 237 // contain a single response from the first good request. | 237 // contain a single response from the first good request. |
| 238 void TestBadRequest(const base::Value& message); | 238 void TestBadRequest(const base::Value& message); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 // Verify rejection if startDaemon request has no "consent" parameter. | 591 // Verify rejection if startDaemon request has no "consent" parameter. |
| 592 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) { | 592 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) { |
| 593 base::DictionaryValue message; | 593 base::DictionaryValue message; |
| 594 message.SetString("type", "startDaemon"); | 594 message.SetString("type", "startDaemon"); |
| 595 message.Set("config", base::DictionaryValue().DeepCopy()); | 595 message.Set("config", base::DictionaryValue().DeepCopy()); |
| 596 TestBadRequest(message); | 596 TestBadRequest(message); |
| 597 } | 597 } |
| 598 | 598 |
| 599 } // namespace remoting | 599 } // namespace remoting |
| OLD | NEW |