Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: chrome/test/nacl/pnacl_header_test.cc

Issue 657313003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/nacl/pnacl_header_test.h" 5 #include "chrome/test/nacl/pnacl_header_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/test/scoped_path_override.h" 9 #include "base/test/scoped_path_override.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch( 94 scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch(
95 const HttpRequest& request) { 95 const HttpRequest& request) {
96 // Avoid favicon.ico warning by giving it a dummy icon. 96 // Avoid favicon.ico warning by giving it a dummy icon.
97 if (request.relative_url.find("favicon.ico") != std::string::npos) { 97 if (request.relative_url.find("favicon.ico") != std::string::npos) {
98 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); 98 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse());
99 http_response->set_code(net::HTTP_OK); 99 http_response->set_code(net::HTTP_OK);
100 http_response->set_content(""); 100 http_response->set_content("");
101 http_response->set_content_type("application/octet-stream"); 101 http_response->set_content_type("application/octet-stream");
102 return http_response.PassAs<HttpResponse>(); 102 return http_response.Pass();
103 } 103 }
104 104
105 // Skip other non-pexe files and let ServeFilesFromDirectory handle it. 105 // Skip other non-pexe files and let ServeFilesFromDirectory handle it.
106 GURL absolute_url = embedded_test_server()->GetURL(request.relative_url); 106 GURL absolute_url = embedded_test_server()->GetURL(request.relative_url);
107 if (absolute_url.path().find(".pexe") == std::string::npos) 107 if (absolute_url.path().find(".pexe") == std::string::npos)
108 return scoped_ptr<HttpResponse>(); 108 return scoped_ptr<HttpResponse>();
109 109
110 // For pexe files, check for the special Accept header, 110 // For pexe files, check for the special Accept header,
111 // along with the expected ResourceType of the URL request. 111 // along with the expected ResourceType of the URL request.
112 EXPECT_NE(0U, request.headers.count("Accept")); 112 EXPECT_NE(0U, request.headers.count("Accept"));
(...skipping 12 matching lines...) Expand all
125 EXPECT_EQ(1U, request.headers.count("Origin")); 125 EXPECT_EQ(1U, request.headers.count("Origin"));
126 cors_loads_ += 1; 126 cors_loads_ += 1;
127 } 127 }
128 128
129 // After checking the header, just return a 404. We don't need to actually 129 // After checking the header, just return a 404. We don't need to actually
130 // compile and stopping with a 404 is faster. 130 // compile and stopping with a 404 is faster.
131 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); 131 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse());
132 http_response->set_code(net::HTTP_NOT_FOUND); 132 http_response->set_code(net::HTTP_NOT_FOUND);
133 http_response->set_content("PEXE ... not found"); 133 http_response->set_content("PEXE ... not found");
134 http_response->set_content_type("application/octet-stream"); 134 http_response->set_content_type("application/octet-stream");
135 return http_response.PassAs<HttpResponse>(); 135 return http_response.Pass();
136 } 136 }
137 137
138 IN_PROC_BROWSER_TEST_F(PnaclHeaderTest, TestHasPnaclHeader) { 138 IN_PROC_BROWSER_TEST_F(PnaclHeaderTest, TestHasPnaclHeader) {
139 // Load 2 pexes, one same origin and one cross orgin. 139 // Load 2 pexes, one same origin and one cross orgin.
140 RunLoadTest("/nacl/pnacl_request_header/pnacl_request_header.html", 1, 1); 140 RunLoadTest("/nacl/pnacl_request_header/pnacl_request_header.html", 1, 1);
141 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698