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

Side by Side Diff: chrome/browser/password_manager/password_manager_test_base.cc

Issue 2851103002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: fix Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/password_manager/password_manager_test_base.h" 5 #include "chrome/browser/password_manager/password_manager_test_base.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 12 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
13 #include "chrome/browser/password_manager/password_store_factory.h" 13 #include "chrome/browser/password_manager/password_store_factory.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_io_data.h" 15 #include "chrome/browser/profiles/profile_io_data.h"
16 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" 16 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 18 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "components/autofill/core/browser/autofill_test_utils.h" 21 #include "components/autofill/core/browser/autofill_test_utils.h"
22 #include "components/password_manager/core/browser/password_manager_test_utils.h " 22 #include "components/password_manager/core/browser/password_manager_test_utils.h "
23 #include "components/password_manager/core/browser/test_password_store.h" 23 #include "components/password_manager/core/browser/test_password_store.h"
24 #include "content/public/browser/navigation_details.h" 24 #include "content/public/browser/navigation_details.h"
25 #include "content/public/browser/navigation_handle.h" 25 #include "content/public/browser/navigation_handle.h"
26 #include "content/public/browser/render_frame_host.h" 26 #include "content/public/browser/render_frame_host.h"
27 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
28 #include "net/cert/cert_verify_result.h" 28 #include "net/cert/cert_verify_result.h"
29 #include "net/dns/mock_host_resolver.h"
29 #include "net/http/transport_security_state.h" 30 #include "net/http/transport_security_state.h"
30 #include "net/test/embedded_test_server/embedded_test_server.h" 31 #include "net/test/embedded_test_server/embedded_test_server.h"
31 #include "net/url_request/url_request_context.h" 32 #include "net/url_request/url_request_context.h"
32 #include "net/url_request/url_request_context_getter.h" 33 #include "net/url_request/url_request_context_getter.h"
33 34
34 namespace { 35 namespace {
35 36
36 // A helper class that synchronously waits until the password store handles a 37 // A helper class that synchronously waits until the password store handles a
37 // GetLogins() request. 38 // GetLogins() request.
38 class PasswordStoreResultsObserver 39 class PasswordStoreResultsObserver
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 password_manager::BuildPasswordStore< 250 password_manager::BuildPasswordStore<
250 content::BrowserContext, password_manager::TestPasswordStore>); 251 content::BrowserContext, password_manager::TestPasswordStore>);
251 ASSERT_TRUE(embedded_test_server()->Start()); 252 ASSERT_TRUE(embedded_test_server()->Start());
252 253
253 // Setup HTTPS server serving files from standard test directory. 254 // Setup HTTPS server serving files from standard test directory.
254 static constexpr base::FilePath::CharType kDocRoot[] = 255 static constexpr base::FilePath::CharType kDocRoot[] =
255 FILE_PATH_LITERAL("chrome/test/data"); 256 FILE_PATH_LITERAL("chrome/test/data");
256 https_test_server().ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); 257 https_test_server().ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
257 ASSERT_TRUE(https_test_server().Start()); 258 ASSERT_TRUE(https_test_server().Start());
258 259
260 // Setup the mock host resolver
261 host_resolver()->AddRule("*", "127.0.0.1");
262
259 // Whitelist all certs for the HTTPS server. 263 // Whitelist all certs for the HTTPS server.
260 auto cert = https_test_server().GetCertificate(); 264 auto cert = https_test_server().GetCertificate();
261 net::CertVerifyResult verify_result; 265 net::CertVerifyResult verify_result;
262 verify_result.cert_status = 0; 266 verify_result.cert_status = 0;
263 verify_result.is_issued_by_known_root = true; 267 verify_result.is_issued_by_known_root = true;
264 verify_result.verified_cert = cert; 268 verify_result.verified_cert = cert;
265 mock_cert_verifier().AddResultForCert(cert.get(), verify_result, net::OK); 269 mock_cert_verifier().AddResultForCert(cert.get(), verify_result, net::OK);
266 270
267 // Add a tab with a customized ManagePasswordsUIController. Thus, we can 271 // Add a tab with a customized ManagePasswordsUIController. Thus, we can
268 // intercept useful UI events. 272 // intercept useful UI events.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 464
461 content::BrowserThread::PostTaskAndReply( 465 content::BrowserThread::PostTaskAndReply(
462 content::BrowserThread::IO, FROM_HERE, 466 content::BrowserThread::IO, FROM_HERE,
463 base::BindOnce( 467 base::BindOnce(
464 &AddHSTSHostImpl, 468 &AddHSTSHostImpl,
465 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), 469 make_scoped_refptr(browser()->profile()->GetRequestContext()), host),
466 run_loop.QuitClosure()); 470 run_loop.QuitClosure());
467 471
468 run_loop.Run(); 472 run_loop.Run();
469 } 473 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_manager_browsertest.cc ('k') | chrome/browser/pdf/pdf_extension_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698