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

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: Removed duplicate invocation 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
835 PathService::Get(base::FILE_EXE, &app_path); 841 PathService::Get(base::FILE_EXE, &app_path);
842 #endif // OS_ANDROID
843
836 GURL app_url = FilePathToFileURL(app_path); 844 GURL app_url = FilePathToFileURL(app_path);
837 845
838 TestDelegate d; 846 TestDelegate d;
839 { 847 {
840 scoped_ptr<URLRequest> r( 848 scoped_ptr<URLRequest> r(
841 default_context_.CreateRequest(app_url, DEFAULT_PRIORITY, &d)); 849 default_context_.CreateRequest(app_url, DEFAULT_PRIORITY, &d));
842 850
843 r->Start(); 851 r->Start();
844 EXPECT_TRUE(r->is_pending()); 852 EXPECT_TRUE(r->is_pending());
845 853
(...skipping 9248 matching lines...) Expand 10 before | Expand all | Expand 10 after
10094 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10102 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10095 10103
10096 req->Start(); 10104 req->Start();
10097 req->Cancel(); 10105 req->Cancel();
10098 base::RunLoop().RunUntilIdle(); 10106 base::RunLoop().RunUntilIdle();
10099 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); 10107 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
10100 EXPECT_EQ(0, d.received_redirect_count()); 10108 EXPECT_EQ(0, d.received_redirect_count());
10101 } 10109 }
10102 10110
10103 } // namespace net 10111 } // 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