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/thread_task_runner_handle.h" | 9 #include "base/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 net::URLFetcherDelegate* fetcher_delegate, | 83 net::URLFetcherDelegate* fetcher_delegate, |
84 const std::string& response_data, | 84 const std::string& response_data, |
85 net::HttpStatusCode response_code, | 85 net::HttpStatusCode response_code, |
86 net::URLRequestStatus::Status status) { | 86 net::URLRequestStatus::Status status) { |
87 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( | 87 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( |
88 url, fetcher_delegate, response_data, response_code, status)); | 88 url, fetcher_delegate, response_data, response_code, status)); |
89 scoped_refptr<net::HttpResponseHeaders> headers = | 89 scoped_refptr<net::HttpResponseHeaders> headers = |
90 new net::HttpResponseHeaders(""); | 90 new net::HttpResponseHeaders(""); |
91 headers->AddHeader("Content-Type: application/json"); | 91 headers->AddHeader("Content-Type: application/json"); |
92 fetcher->set_response_headers(headers); | 92 fetcher->set_response_headers(headers); |
93 return fetcher.Pass(); | 93 return fetcher; |
94 } | 94 } |
95 | 95 |
96 content::TestBrowserThreadBundle thread_bundle_; | 96 content::TestBrowserThreadBundle thread_bundle_; |
97 net::FakeURLFetcherFactory fetcher_factory_; | 97 net::FakeURLFetcherFactory fetcher_factory_; |
98 base::DictionaryValue info_; | 98 base::DictionaryValue info_; |
99 scoped_ptr<PrivetV3Session> session_; | 99 scoped_ptr<PrivetV3Session> session_; |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(PrivetV3SessionTest, InitError) { | 102 TEST_F(PrivetV3SessionTest, InitError) { |
103 EXPECT_CALL(*this, OnInitializedMock(Result::STATUS_CONNECTIONERROR, _)) | 103 EXPECT_CALL(*this, OnInitializedMock(Result::STATUS_CONNECTIONERROR, _)) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 base::DictionaryValue input; | 332 base::DictionaryValue input; |
333 input.SetString("id", id); | 333 input.SetString("id", id); |
334 session_->SendMessage( | 334 session_->SendMessage( |
335 "/privet/v3/commands/status", input, | 335 "/privet/v3/commands/status", input, |
336 base::Bind(&PrivetV3SessionTest::OnMessageSend, base::Unretained(this))); | 336 base::Bind(&PrivetV3SessionTest::OnMessageSend, base::Unretained(this))); |
337 base::RunLoop().RunUntilIdle(); | 337 base::RunLoop().RunUntilIdle(); |
338 } | 338 } |
339 | 339 |
340 } // namespace extensions | 340 } // namespace extensions |
OLD | NEW |