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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1839273002: Use /etc/hosts for URLRequestTest.FileTest on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using /etc/hosts Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 5 #include <utility>
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 EXPECT_EQ(0, r->GetSocketAddress().port()); 825 EXPECT_EQ(0, r->GetSocketAddress().port());
826 826
827 HttpRequestHeaders headers; 827 HttpRequestHeaders headers;
828 EXPECT_FALSE(r->GetFullRequestHeaders(&headers)); 828 EXPECT_FALSE(r->GetFullRequestHeaders(&headers));
829 } 829 }
830 } 830 }
831 831
832 #if !defined(DISABLE_FILE_SUPPORT) 832 #if !defined(DISABLE_FILE_SUPPORT)
833 TEST_F(URLRequestTest, FileTest) { 833 TEST_F(URLRequestTest, FileTest) {
834 base::FilePath app_path; 834 base::FilePath app_path;
835
836 #if defined(OS_ANDROID)
837 // Android devices are not guaranteed to be able to read /proc/self/exe
838 // Use /etc/hosts instead
839 app_path = base::FilePath("/etc/hosts");
840 #else
841 PathService::Get(base::FILE_EXE, &app_path);
842 #endif // OS_ANDROID
843
835 PathService::Get(base::FILE_EXE, &app_path); 844 PathService::Get(base::FILE_EXE, &app_path);
pauljensen 2016/04/07 17:18:08 this won't work...you've still got the line here
kraush 2016/04/07 17:21:31 Argh, sorry. I did run it and it did work, but tha
836 GURL app_url = FilePathToFileURL(app_path); 845 GURL app_url = FilePathToFileURL(app_path);
837 846
838 TestDelegate d; 847 TestDelegate d;
839 { 848 {
840 scoped_ptr<URLRequest> r( 849 scoped_ptr<URLRequest> r(
841 default_context_.CreateRequest(app_url, DEFAULT_PRIORITY, &d)); 850 default_context_.CreateRequest(app_url, DEFAULT_PRIORITY, &d));
842 851
843 r->Start(); 852 r->Start();
844 EXPECT_TRUE(r->is_pending()); 853 EXPECT_TRUE(r->is_pending());
845 854
(...skipping 9248 matching lines...) Expand 10 before | Expand all | Expand 10 after
10094 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10103 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10095 10104
10096 req->Start(); 10105 req->Start();
10097 req->Cancel(); 10106 req->Cancel();
10098 base::RunLoop().RunUntilIdle(); 10107 base::RunLoop().RunUntilIdle();
10099 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); 10108 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
10100 EXPECT_EQ(0, d.received_redirect_count()); 10109 EXPECT_EQ(0, d.received_redirect_count());
10101 } 10110 }
10102 10111
10103 } // namespace net 10112 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698