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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 extension->GetResourceURL("test.dat"), | 292 extension->GetResourceURL("test.dat"), |
293 net::DEFAULT_PRIORITY, | 293 net::DEFAULT_PRIORITY, |
294 &test_delegate_)); | 294 &test_delegate_)); |
295 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); | 295 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); |
296 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); | 296 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); |
297 | 297 |
298 // Check that cache-related headers are set. | 298 // Check that cache-related headers are set. |
299 std::string etag; | 299 std::string etag; |
300 request->GetResponseHeaderByName("ETag", &etag); | 300 request->GetResponseHeaderByName("ETag", &etag); |
301 EXPECT_TRUE(base::StartsWithASCII(etag, "\"", false)); | 301 EXPECT_TRUE(base::StartsWithASCII(etag, "\"", false)); |
302 EXPECT_TRUE(EndsWith(etag, "\"", false)); | 302 EXPECT_TRUE(base::EndsWith(etag, "\"", false)); |
303 | 303 |
304 std::string revalidation_header; | 304 std::string revalidation_header; |
305 request->GetResponseHeaderByName("cache-control", &revalidation_header); | 305 request->GetResponseHeaderByName("cache-control", &revalidation_header); |
306 EXPECT_EQ("no-cache", revalidation_header); | 306 EXPECT_EQ("no-cache", revalidation_header); |
307 | 307 |
308 // We set test.dat as web-accessible, so it should have a CORS header. | 308 // We set test.dat as web-accessible, so it should have a CORS header. |
309 std::string access_control; | 309 std::string access_control; |
310 request->GetResponseHeaderByName("Access-Control-Allow-Origin", | 310 request->GetResponseHeaderByName("Access-Control-Allow-Origin", |
311 &access_control); | 311 &access_control); |
312 EXPECT_EQ("*", access_control); | 312 EXPECT_EQ("*", access_control); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 resource_context_.GetRequestContext()->CreateRequest( | 351 resource_context_.GetRequestContext()->CreateRequest( |
352 extension->GetResourceURL("test.dat"), | 352 extension->GetResourceURL("test.dat"), |
353 net::DEFAULT_PRIORITY, | 353 net::DEFAULT_PRIORITY, |
354 &test_delegate_)); | 354 &test_delegate_)); |
355 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); | 355 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); |
356 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); | 356 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 } // namespace extensions | 360 } // namespace extensions |
OLD | NEW |