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 "components/copresence/rpc/http_post.h" | 5 #include "components/copresence/rpc/http_post.h" |
6 | 6 |
7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "components/copresence/proto/data.pb.h" | 8 #include "components/copresence/proto/data.pb.h" |
9 #include "net/base/url_util.h" | 9 #include "net/base/url_util.h" |
10 #include "net/http/http_status_code.h" | 10 #include "net/http/http_status_code.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 std::string api_key_sent; | 72 std::string api_key_sent; |
73 net::GetValueForKeyInQuery(GetFetcher()->GetOriginalURL(), | 73 net::GetValueForKeyInQuery(GetFetcher()->GetOriginalURL(), |
74 HttpPost::kApiKeyField, | 74 HttpPost::kApiKeyField, |
75 &api_key_sent); | 75 &api_key_sent); |
76 return api_key_sent; | 76 return api_key_sent; |
77 } | 77 } |
78 | 78 |
79 const std::string GetTracingTokenSent() { | 79 const std::string GetTracingTokenSent() { |
80 std::string tracing_token_sent; | 80 std::string tracing_token_sent; |
81 net::GetValueForKeyInQuery(GetFetcher()->GetOriginalURL(), | 81 net::GetValueForKeyInQuery(GetFetcher()->GetOriginalURL(), |
82 HttpPost::kTracingTokenField, | 82 HttpPost::kTracingField, |
83 &tracing_token_sent); | 83 &tracing_token_sent); |
84 return tracing_token_sent; | 84 return tracing_token_sent; |
85 } | 85 } |
86 | 86 |
87 net::TestURLFetcherFactory fetcher_factory_; | 87 net::TestURLFetcherFactory fetcher_factory_; |
88 scoped_refptr<net::TestURLRequestContextGetter> context_getter_; | 88 scoped_refptr<net::TestURLRequestContextGetter> context_getter_; |
89 | 89 |
90 ClientVersion proto_; | 90 ClientVersion proto_; |
91 | 91 |
92 int received_response_code_; | 92 int received_response_code_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 TEST_F(HttpPostTest, ErrorResponse) { | 133 TEST_F(HttpPostTest, ErrorResponse) { |
134 EXPECT_TRUE(ResponsePassedThrough( | 134 EXPECT_TRUE(ResponsePassedThrough( |
135 net::HTTP_BAD_REQUEST, "Bad client. Shame on you.")); | 135 net::HTTP_BAD_REQUEST, "Bad client. Shame on you.")); |
136 EXPECT_TRUE(ResponsePassedThrough( | 136 EXPECT_TRUE(ResponsePassedThrough( |
137 net::HTTP_INTERNAL_SERVER_ERROR, "I'm dying. Forgive me.")); | 137 net::HTTP_INTERNAL_SERVER_ERROR, "I'm dying. Forgive me.")); |
138 EXPECT_TRUE(ResponsePassedThrough(-1, "")); | 138 EXPECT_TRUE(ResponsePassedThrough(-1, "")); |
139 } | 139 } |
140 | 140 |
141 } // namespace copresence | 141 } // namespace copresence |
OLD | NEW |