OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <ostream> | 5 #include <ostream> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 FailedRequestParams( | 242 FailedRequestParams( |
243 DM_STATUS_SERVICE_DEVICE_ID_CONFLICT, | 243 DM_STATUS_SERVICE_DEVICE_ID_CONFLICT, |
244 net::URLRequestStatus::SUCCESS, | 244 net::URLRequestStatus::SUCCESS, |
245 409, | 245 409, |
246 PROTO_STRING(kResponseEmpty)), | 246 PROTO_STRING(kResponseEmpty)), |
247 FailedRequestParams( | 247 FailedRequestParams( |
248 DM_STATUS_SERVICE_DEVICE_NOT_FOUND, | 248 DM_STATUS_SERVICE_DEVICE_NOT_FOUND, |
249 net::URLRequestStatus::SUCCESS, | 249 net::URLRequestStatus::SUCCESS, |
250 410, | 250 410, |
251 PROTO_STRING(kResponseEmpty)), | 251 PROTO_STRING(kResponseEmpty)), |
252 // TODO(pastarmovj): Remove once DM server is deployed. | |
253 FailedRequestParams( | |
254 DM_STATUS_SERVICE_DEVICE_NOT_FOUND, | |
255 net::URLRequestStatus::SUCCESS, | |
256 901, | |
257 PROTO_STRING(kResponseEmpty)), | |
258 FailedRequestParams( | 252 FailedRequestParams( |
259 DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID, | 253 DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID, |
260 net::URLRequestStatus::SUCCESS, | 254 net::URLRequestStatus::SUCCESS, |
261 401, | 255 401, |
262 PROTO_STRING(kResponseEmpty)), | 256 PROTO_STRING(kResponseEmpty)), |
263 FailedRequestParams( | 257 FailedRequestParams( |
264 DM_STATUS_REQUEST_INVALID, | 258 DM_STATUS_REQUEST_INVALID, |
265 net::URLRequestStatus::SUCCESS, | 259 net::URLRequestStatus::SUCCESS, |
266 400, | 260 400, |
267 PROTO_STRING(kResponseEmpty)), | 261 PROTO_STRING(kResponseEmpty)), |
268 FailedRequestParams( | 262 FailedRequestParams( |
269 DM_STATUS_TEMPORARY_UNAVAILABLE, | 263 DM_STATUS_TEMPORARY_UNAVAILABLE, |
270 net::URLRequestStatus::SUCCESS, | 264 net::URLRequestStatus::SUCCESS, |
271 404, | 265 404, |
272 PROTO_STRING(kResponseEmpty)), | 266 PROTO_STRING(kResponseEmpty)), |
273 FailedRequestParams( | 267 FailedRequestParams( |
274 DM_STATUS_SERVICE_ACTIVATION_PENDING, | 268 DM_STATUS_SERVICE_ACTIVATION_PENDING, |
275 net::URLRequestStatus::SUCCESS, | 269 net::URLRequestStatus::SUCCESS, |
276 412, | 270 412, |
277 PROTO_STRING(kResponseEmpty)), | 271 PROTO_STRING(kResponseEmpty)), |
278 FailedRequestParams( | 272 FailedRequestParams( |
279 DM_STATUS_MISSING_LICENSES, | 273 DM_STATUS_MISSING_LICENSES, |
280 net::URLRequestStatus::SUCCESS, | 274 net::URLRequestStatus::SUCCESS, |
281 402, | 275 402, |
282 PROTO_STRING(kResponseEmpty)), | |
283 // TODO(pastarmovj): Remove once DM server is deployed. | |
284 FailedRequestParams( | |
285 DM_STATUS_SERVICE_ACTIVATION_PENDING, | |
286 net::URLRequestStatus::SUCCESS, | |
287 491, | |
288 PROTO_STRING(kResponseEmpty)))); | 276 PROTO_STRING(kResponseEmpty)))); |
289 | 277 |
290 // Simple query parameter parser for testing. | 278 // Simple query parameter parser for testing. |
291 class QueryParams { | 279 class QueryParams { |
292 public: | 280 public: |
293 explicit QueryParams(const std::string& query) { | 281 explicit QueryParams(const std::string& query) { |
294 base::SplitStringIntoKeyValuePairs(query, '=', '&', ¶ms_); | 282 base::SplitStringIntoKeyValuePairs(query, '=', '&', ¶ms_); |
295 } | 283 } |
296 | 284 |
297 bool Check(const std::string& name, const std::string& expected_value) { | 285 bool Check(const std::string& name, const std::string& expected_value) { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 539 |
552 // Verify that a new URLFetcher was started that bypasses the proxy. | 540 // Verify that a new URLFetcher was started that bypasses the proxy. |
553 fetcher = factory_.GetFetcherByID(0); | 541 fetcher = factory_.GetFetcherByID(0); |
554 ASSERT_TRUE(fetcher); | 542 ASSERT_TRUE(fetcher); |
555 EXPECT_TRUE((fetcher->GetLoadFlags() & net::LOAD_BYPASS_PROXY) != 0); | 543 EXPECT_TRUE((fetcher->GetLoadFlags() & net::LOAD_BYPASS_PROXY) != 0); |
556 EXPECT_EQ(original_url, fetcher->GetOriginalURL()); | 544 EXPECT_EQ(original_url, fetcher->GetOriginalURL()); |
557 EXPECT_EQ(upload_data, fetcher->upload_data()); | 545 EXPECT_EQ(upload_data, fetcher->upload_data()); |
558 } | 546 } |
559 | 547 |
560 } // namespace policy | 548 } // namespace policy |
OLD | NEW |