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

Side by Side Diff: chrome/browser/io_thread_unittest.cc

Issue 2753123002: Add --ignore-certificate-errors-spki-list switch and UMA histogram. (Closed)
Patch Set: Really add IgnoreErrorsCertVerifier. Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, 451 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest,
452 IgnoreCertificateErrors) { 452 IgnoreCertificateErrors) {
453 command_line_.AppendSwitch("ignore-certificate-errors"); 453 command_line_.AppendSwitch("ignore-certificate-errors");
454 454
455 ConfigureParamsFromFieldTrialsAndCommandLine(); 455 ConfigureParamsFromFieldTrialsAndCommandLine();
456 456
457 EXPECT_TRUE(params_.ignore_certificate_errors); 457 EXPECT_TRUE(params_.ignore_certificate_errors);
458 } 458 }
459 459
460 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest,
461 DisableCertificateErrorsSPKIList) {
462 const std::string spki = "BZef6CjpE0HUDfp5ra3F3soQ9kkFxZoBo5PiK1hpudI=";
463 command_line_.AppendSwitchASCII("ignore-certificate-errors-spki-list",
464 "foo," + spki);
465 net::HashValue hash(net::HASH_VALUE_SHA256);
466 ASSERT_TRUE(hash.FromString("sha256/" + spki));
467 net::SHA256HashValue sha256;
468 memcpy(&sha256, hash.data(), sizeof(sha256));
469
470 ConfigureParamsFromFieldTrialsAndCommandLine();
471
472 EXPECT_EQ(1u, params_.ignore_certificate_error_spki_set.size());
473 EXPECT_TRUE(
474 base::ContainsKey(params_.ignore_certificate_error_spki_set, sha256));
475 }
476
460 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, TestingFixedPort) { 477 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, TestingFixedPort) {
461 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); 478 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42");
462 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); 479 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137");
463 480
464 ConfigureParamsFromFieldTrialsAndCommandLine(); 481 ConfigureParamsFromFieldTrialsAndCommandLine();
465 482
466 EXPECT_EQ(42u, params_.testing_fixed_http_port); 483 EXPECT_EQ(42u, params_.testing_fixed_http_port);
467 EXPECT_EQ(137u, params_.testing_fixed_https_port); 484 EXPECT_EQ(137u, params_.testing_fixed_https_port);
468 } 485 }
469 486
470 } // namespace test 487 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698