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

Side by Side Diff: chromeos/network/network_connection_handler_unittest.cc

Issue 2722733002: Revert of Use TaskScheduler instead of WorkerPool in nss_cert_database.cc. (Closed)
Patch Set: rebase Created 3 years, 9 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 | « chromeos/network/network_cert_migrator_unittest.cc ('k') | net/cert/nss_cert_database.h » ('j') | 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 "chromeos/network/network_connection_handler.h" 5 #include "chromeos/network/network_connection_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 17 #include "base/run_loop.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/test/scoped_task_scheduler.h"
19 #include "chromeos/cert_loader.h" 19 #include "chromeos/cert_loader.h"
20 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
21 #include "chromeos/dbus/shill_device_client.h" 21 #include "chromeos/dbus/shill_device_client.h"
22 #include "chromeos/dbus/shill_manager_client.h" 22 #include "chromeos/dbus/shill_manager_client.h"
23 #include "chromeos/dbus/shill_profile_client.h" 23 #include "chromeos/dbus/shill_profile_client.h"
24 #include "chromeos/dbus/shill_service_client.h" 24 #include "chromeos/dbus/shill_service_client.h"
25 #include "chromeos/network/managed_network_configuration_handler_impl.h" 25 #include "chromeos/network/managed_network_configuration_handler_impl.h"
26 #include "chromeos/network/network_configuration_handler.h" 26 #include "chromeos/network/network_configuration_handler.h"
27 #include "chromeos/network/network_connection_observer.h" 27 #include "chromeos/network/network_connection_observer.h"
28 #include "chromeos/network/network_profile_handler.h" 28 #include "chromeos/network/network_profile_handler.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 ~NetworkConnectionHandlerTest() override {} 104 ~NetworkConnectionHandlerTest() override {}
105 105
106 void SetUp() override { 106 void SetUp() override {
107 ASSERT_TRUE(test_nssdb_.is_open()); 107 ASSERT_TRUE(test_nssdb_.is_open());
108 108
109 // Use the same DB for public and private slot. 109 // Use the same DB for public and private slot.
110 test_nsscertdb_.reset(new net::NSSCertDatabaseChromeOS( 110 test_nsscertdb_.reset(new net::NSSCertDatabaseChromeOS(
111 crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nssdb_.slot())), 111 crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nssdb_.slot())),
112 crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nssdb_.slot())))); 112 crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nssdb_.slot()))));
113 test_nsscertdb_->SetSlowTaskRunnerForTest(message_loop_.task_runner());
113 114
114 CertLoader::Initialize(); 115 CertLoader::Initialize();
115 CertLoader::ForceHardwareBackedForTesting(); 116 CertLoader::ForceHardwareBackedForTesting();
116 117
117 DBusThreadManager::Initialize(); 118 DBusThreadManager::Initialize();
118 DBusThreadManager* dbus_manager = DBusThreadManager::Get(); 119 DBusThreadManager* dbus_manager = DBusThreadManager::Get();
119 test_manager_client_ = 120 test_manager_client_ =
120 dbus_manager->GetShillManagerClient()->GetTestInterface(); 121 dbus_manager->GetShillManagerClient()->GetTestInterface();
121 test_service_client_ = 122 test_service_client_ =
122 dbus_manager->GetShillServiceClient()->GetTestInterface(); 123 dbus_manager->GetShillServiceClient()->GetTestInterface();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 std::unique_ptr<NetworkConfigurationHandler> network_config_handler_; 303 std::unique_ptr<NetworkConfigurationHandler> network_config_handler_;
303 std::unique_ptr<NetworkConnectionHandler> network_connection_handler_; 304 std::unique_ptr<NetworkConnectionHandler> network_connection_handler_;
304 std::unique_ptr<TestNetworkConnectionObserver> network_connection_observer_; 305 std::unique_ptr<TestNetworkConnectionObserver> network_connection_observer_;
305 std::unique_ptr<ManagedNetworkConfigurationHandlerImpl> 306 std::unique_ptr<ManagedNetworkConfigurationHandlerImpl>
306 managed_config_handler_; 307 managed_config_handler_;
307 std::unique_ptr<NetworkProfileHandler> network_profile_handler_; 308 std::unique_ptr<NetworkProfileHandler> network_profile_handler_;
308 ShillManagerClient::TestInterface* test_manager_client_; 309 ShillManagerClient::TestInterface* test_manager_client_;
309 ShillServiceClient::TestInterface* test_service_client_; 310 ShillServiceClient::TestInterface* test_service_client_;
310 crypto::ScopedTestNSSDB test_nssdb_; 311 crypto::ScopedTestNSSDB test_nssdb_;
311 std::unique_ptr<net::NSSCertDatabaseChromeOS> test_nsscertdb_; 312 std::unique_ptr<net::NSSCertDatabaseChromeOS> test_nsscertdb_;
312 base::test::ScopedTaskScheduler scoped_task_scheduler_; 313 base::MessageLoopForUI message_loop_;
313 std::string result_; 314 std::string result_;
314 315
315 private: 316 private:
316 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandlerTest); 317 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandlerTest);
317 }; 318 };
318 319
319 namespace { 320 namespace {
320 321
321 const char* kNoNetwork = "no-network"; 322 const char* kNoNetwork = "no-network";
322 const char* kWifi0 = "wifi0"; 323 const char* kWifi0 = "wifi0";
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 Connect(kNoNetwork); 491 Connect(kNoNetwork);
491 EXPECT_EQ(NetworkConnectionHandler::kErrorConfigureFailed, 492 EXPECT_EQ(NetworkConnectionHandler::kErrorConfigureFailed,
492 GetResultAndReset()); 493 GetResultAndReset());
493 494
494 EXPECT_TRUE(Configure(kConfigConnectable)); 495 EXPECT_TRUE(Configure(kConfigConnectable));
495 Disconnect(kWifi0); 496 Disconnect(kWifi0);
496 EXPECT_EQ(NetworkConnectionHandler::kErrorNotConnected, GetResultAndReset()); 497 EXPECT_EQ(NetworkConnectionHandler::kErrorNotConnected, GetResultAndReset());
497 } 498 }
498 499
499 } // namespace chromeos 500 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_cert_migrator_unittest.cc ('k') | net/cert/nss_cert_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698