| OLD | NEW |
| 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 "chrome/browser/extensions/api/gcd_private/privet_v3_session.h" | 5 #include "chrome/browser/extensions/api/gcd_private/privet_v3_session.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" | 10 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 })); | 297 })); |
| 298 session_->StartPairing(PairingType::PAIRING_TYPE_EMBEDDEDCODE, | 298 session_->StartPairing(PairingType::PAIRING_TYPE_EMBEDDEDCODE, |
| 299 base::Bind(&PrivetV3SessionTest::OnPairingStarted, | 299 base::Bind(&PrivetV3SessionTest::OnPairingStarted, |
| 300 base::Unretained(this))); | 300 base::Unretained(this))); |
| 301 base::RunLoop().RunUntilIdle(); | 301 base::RunLoop().RunUntilIdle(); |
| 302 | 302 |
| 303 fetcher_factory_.SetFakeResponse( | 303 fetcher_factory_.SetFakeResponse( |
| 304 GURL("http://host:180/privet/v3/pairing/cancel"), kInfoResponse, | 304 GURL("http://host:180/privet/v3/pairing/cancel"), kInfoResponse, |
| 305 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 305 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 306 EXPECT_CALL(*this, OnPostData(_)) | 306 EXPECT_CALL(*this, OnPostData(_)) |
| 307 .WillOnce(Invoke([this](const base::DictionaryValue& data) { | 307 .WillOnce(Invoke([](const base::DictionaryValue& data) { |
| 308 std::string session_id; | 308 std::string session_id; |
| 309 EXPECT_TRUE(data.GetString("sessionId", &session_id)); | 309 EXPECT_TRUE(data.GetString("sessionId", &session_id)); |
| 310 })); | 310 })); |
| 311 | 311 |
| 312 session_.reset(); | 312 session_.reset(); |
| 313 base::RunLoop().RunUntilIdle(); | 313 base::RunLoop().RunUntilIdle(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 TEST_F(PrivetV3SessionTest, SendMessage) { | 316 TEST_F(PrivetV3SessionTest, SendMessage) { |
| 317 session_->use_https_ = true; | 317 session_->use_https_ = true; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 332 | 332 |
| 333 base::DictionaryValue input; | 333 base::DictionaryValue input; |
| 334 input.SetString("id", id); | 334 input.SetString("id", id); |
| 335 session_->SendMessage( | 335 session_->SendMessage( |
| 336 "/privet/v3/commands/status", input, | 336 "/privet/v3/commands/status", input, |
| 337 base::Bind(&PrivetV3SessionTest::OnMessageSend, base::Unretained(this))); | 337 base::Bind(&PrivetV3SessionTest::OnMessageSend, base::Unretained(this))); |
| 338 base::RunLoop().RunUntilIdle(); | 338 base::RunLoop().RunUntilIdle(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 } // namespace extensions | 341 } // namespace extensions |
| OLD | NEW |