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

Unified Diff: chromeos/network/network_state_handler_unittest.cc

Issue 13845023: Correctly set technology state to UNAVAILABLE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TexchnologyState unit test Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_state_handler_unittest.cc
diff --git a/chromeos/network/network_state_handler_unittest.cc b/chromeos/network/network_state_handler_unittest.cc
index 1d9ce157c8f827b7b0656e4f137a44ce0b819cd5..23f9207d0b1fdd9f4ca51362a3f2a73d76b0bdd2 100644
--- a/chromeos/network/network_state_handler_unittest.cc
+++ b/chromeos/network/network_state_handler_unittest.cc
@@ -130,6 +130,8 @@ class NetworkStateHandlerTest : public testing::Test {
virtual void SetUp() OVERRIDE {
// Initialize DBusThreadManager with a stub implementation.
DBusThreadManager::InitializeWithStub();
+ SetupNetworkStateHandler();
+ message_loop_.RunUntilIdle();
}
virtual void TearDown() OVERRIDE {
@@ -188,8 +190,6 @@ class NetworkStateHandlerTest : public testing::Test {
};
TEST_F(NetworkStateHandlerTest, NetworkStateHandlerStub) {
- SetupNetworkStateHandler();
- message_loop_.RunUntilIdle();
EXPECT_EQ(1u, test_observer_->manager_changed_count());
// Ensure that the network list is the expected size.
const size_t kNumShillManagerClientStubImplServices = 4;
@@ -212,8 +212,6 @@ TEST_F(NetworkStateHandlerTest, NetworkStateHandlerStub) {
}
TEST_F(NetworkStateHandlerTest, TechnologyChanged) {
- SetupNetworkStateHandler();
- message_loop_.RunUntilIdle();
EXPECT_EQ(1u, test_observer_->manager_changed_count());
// Enable a technology.
EXPECT_NE(NetworkStateHandler::TECHNOLOGY_ENABLED,
@@ -233,9 +231,36 @@ TEST_F(NetworkStateHandlerTest, TechnologyChanged) {
network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
}
-TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) {
- SetupNetworkStateHandler();
+TEST_F(NetworkStateHandlerTest, TechnologyState) {
+ ShillManagerClient::TestInterface* manager_test =
+ DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface();
+ EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_UNAVAILABLE,
+ network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
+
+ manager_test->AddTechnology(flimflam::kTypeWimax, false);
+ message_loop_.RunUntilIdle();
+ EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_AVAILABLE,
+ network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
+
+ manager_test->SetTechnologyInitializing(flimflam::kTypeWimax, true);
+ message_loop_.RunUntilIdle();
+ EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_UNINITIALIZED,
+ network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
+
+ manager_test->SetTechnologyInitializing(flimflam::kTypeWimax, false);
+ network_state_handler_->SetTechnologyEnabled(
+ flimflam::kTypeWimax, true, network_handler::ErrorCallback());
message_loop_.RunUntilIdle();
+ EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_ENABLED,
+ network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
+
+ manager_test->RemoveTechnology(flimflam::kTypeWimax);
+ message_loop_.RunUntilIdle();
+ EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_UNAVAILABLE,
+ network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
+}
+
+TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) {
// Set a service property.
const std::string eth0 = "stub_ethernet";
EXPECT_EQ("", network_state_handler_->GetNetworkState(eth0)->security());
@@ -252,8 +277,6 @@ TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) {
}
TEST_F(NetworkStateHandlerTest, NetworkConnectionStateChanged) {
- SetupNetworkStateHandler();
- message_loop_.RunUntilIdle();
// Change a network state.
ShillServiceClient::TestInterface* service_test =
DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
@@ -274,9 +297,6 @@ TEST_F(NetworkStateHandlerTest, NetworkConnectionStateChanged) {
}
TEST_F(NetworkStateHandlerTest, DefaultServiceChanged) {
- SetupNetworkStateHandler();
- message_loop_.RunUntilIdle();
-
ShillManagerClient::TestInterface* manager_test =
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface();
ASSERT_TRUE(manager_test);
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698