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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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 <queue> 5 #include <queue>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); 400 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
401 } 401 }
402 402
403 // Handles |request| by serving a redirect response if the |User-Agent| is 403 // Handles |request| by serving a redirect response if the |User-Agent| is
404 // foobar. 404 // foobar.
405 static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( 405 static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler(
406 const std::string& path, 406 const std::string& path,
407 const GURL& redirect_target, 407 const GURL& redirect_target,
408 const net::test_server::HttpRequest& request) { 408 const net::test_server::HttpRequest& request) {
409 if (!base::StartsWithASCII(path, request.relative_url, true)) 409 if (!base::StartsWith(path, request.relative_url,
410 base::CompareCase::SENSITIVE))
410 return scoped_ptr<net::test_server::HttpResponse>(); 411 return scoped_ptr<net::test_server::HttpResponse>();
411 412
412 std::map<std::string, std::string>::const_iterator it = 413 std::map<std::string, std::string>::const_iterator it =
413 request.headers.find("User-Agent"); 414 request.headers.find("User-Agent");
414 EXPECT_TRUE(it != request.headers.end()); 415 EXPECT_TRUE(it != request.headers.end());
415 if (!base::StartsWithASCII("foobar", it->second, true)) 416 if (!base::StartsWith("foobar", it->second,
417 base::CompareCase::SENSITIVE))
416 return scoped_ptr<net::test_server::HttpResponse>(); 418 return scoped_ptr<net::test_server::HttpResponse>();
417 419
418 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 420 scoped_ptr<net::test_server::BasicHttpResponse> http_response(
419 new net::test_server::BasicHttpResponse); 421 new net::test_server::BasicHttpResponse);
420 http_response->set_code(net::HTTP_MOVED_PERMANENTLY); 422 http_response->set_code(net::HTTP_MOVED_PERMANENTLY);
421 http_response->AddCustomHeader("Location", redirect_target.spec()); 423 http_response->AddCustomHeader("Location", redirect_target.spec());
422 return http_response.Pass(); 424 return http_response.Pass();
423 } 425 }
424 426
425 // Handles |request| by serving a redirect response. 427 // Handles |request| by serving a redirect response.
426 static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( 428 static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler(
427 const std::string& path, 429 const std::string& path,
428 const GURL& redirect_target, 430 const GURL& redirect_target,
429 const net::test_server::HttpRequest& request) { 431 const net::test_server::HttpRequest& request) {
430 if (!base::StartsWithASCII(path, request.relative_url, true)) 432 if (!base::StartsWith(path, request.relative_url,
433 base::CompareCase::SENSITIVE))
431 return scoped_ptr<net::test_server::HttpResponse>(); 434 return scoped_ptr<net::test_server::HttpResponse>();
432 435
433 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 436 scoped_ptr<net::test_server::BasicHttpResponse> http_response(
434 new net::test_server::BasicHttpResponse); 437 new net::test_server::BasicHttpResponse);
435 http_response->set_code(net::HTTP_MOVED_PERMANENTLY); 438 http_response->set_code(net::HTTP_MOVED_PERMANENTLY);
436 http_response->AddCustomHeader("Location", redirect_target.spec()); 439 http_response->AddCustomHeader("Location", redirect_target.spec());
437 return http_response.Pass(); 440 return http_response.Pass();
438 } 441 }
439 442
440 // Handles |request| by serving an empty response. 443 // Handles |request| by serving an empty response.
441 static scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( 444 static scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler(
442 const std::string& path, 445 const std::string& path,
443 const net::test_server::HttpRequest& request) { 446 const net::test_server::HttpRequest& request) {
444 if (base::StartsWithASCII(path, request.relative_url, true)) 447 if (base::StartsWith(path, request.relative_url,
448 base::CompareCase::SENSITIVE))
445 return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); 449 return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse);
446 450
447 return scoped_ptr<net::test_server::HttpResponse>(); 451 return scoped_ptr<net::test_server::HttpResponse>();
448 } 452 }
449 453
450 // Handles |request| by serving cache-able response. 454 // Handles |request| by serving cache-able response.
451 static scoped_ptr<net::test_server::HttpResponse> CacheControlResponseHandler( 455 static scoped_ptr<net::test_server::HttpResponse> CacheControlResponseHandler(
452 const std::string& path, 456 const std::string& path,
453 const net::test_server::HttpRequest& request) { 457 const net::test_server::HttpRequest& request) {
454 if (!base::StartsWithASCII(path, request.relative_url, true)) 458 if (!base::StartsWith(path, request.relative_url,
459 base::CompareCase::SENSITIVE))
455 return scoped_ptr<net::test_server::HttpResponse>(); 460 return scoped_ptr<net::test_server::HttpResponse>();
456 461
457 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 462 scoped_ptr<net::test_server::BasicHttpResponse> http_response(
458 new net::test_server::BasicHttpResponse); 463 new net::test_server::BasicHttpResponse);
459 http_response->AddCustomHeader("Cache-control", "max-age=3600"); 464 http_response->AddCustomHeader("Cache-control", "max-age=3600");
460 http_response->set_content_type("text/plain"); 465 http_response->set_content_type("text/plain");
461 http_response->set_content("dummy text"); 466 http_response->set_content("dummy text");
462 return http_response.Pass(); 467 return http_response.Pass();
463 } 468 }
464 469
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 // Generate and send synthetic touch event. 2563 // Generate and send synthetic touch event.
2559 FocusWaiter waiter(aura_webview); 2564 FocusWaiter waiter(aura_webview);
2560 content::SimulateTouchPressAt(GetEmbedderWebContents(), 2565 content::SimulateTouchPressAt(GetEmbedderWebContents(),
2561 guest_rect.CenterPoint()); 2566 guest_rect.CenterPoint());
2562 2567
2563 // Wait for the TouchStart to propagate and restore focus. Test times out 2568 // Wait for the TouchStart to propagate and restore focus. Test times out
2564 // on failure. 2569 // on failure.
2565 waiter.Wait(); 2570 waiter.Wait();
2566 } 2571 }
2567 #endif 2572 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698