| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 void ErrorCallback(bool error_expected, | 67 void ErrorCallback(bool error_expected, |
| 68 const std::string& expected_id, | 68 const std::string& expected_id, |
| 69 const std::string& error_name, | 69 const std::string& error_name, |
| 70 scoped_ptr<base::DictionaryValue> error_data) { | 70 scoped_ptr<base::DictionaryValue> error_data) { |
| 71 EXPECT_TRUE(error_expected) << "Unexpected error: " << error_name | 71 EXPECT_TRUE(error_expected) << "Unexpected error: " << error_name |
| 72 << " with associated data: \n" | 72 << " with associated data: \n" |
| 73 << PrettyJson(*error_data); | 73 << PrettyJson(*error_data); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void StringResultCallback(const std::string& expected_result, | 76 void ServiceResultCallback(const std::string& expected_result, |
| 77 const std::string& result) { | 77 const std::string& service_path, |
| 78 EXPECT_EQ(expected_result, result); | 78 const std::string& guid) { |
| 79 EXPECT_EQ(expected_result, service_path); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void DBusErrorCallback(const std::string& error_name, | 82 void DBusErrorCallback(const std::string& error_name, |
| 82 const std::string& error_message) { | 83 const std::string& error_message) { |
| 83 EXPECT_TRUE(false) << "DBus Error: " << error_name << "(" << error_message | 84 EXPECT_TRUE(false) << "DBus Error: " << error_name << "(" << error_message |
| 84 << ")"; | 85 << ")"; |
| 85 } | 86 } |
| 86 | 87 |
| 87 class TestCallback { | 88 class TestCallback { |
| 88 public: | 89 public: |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 280 |
| 280 bool PendingProfileEntryDeleterForTest(const std::string& service_path) { | 281 bool PendingProfileEntryDeleterForTest(const std::string& service_path) { |
| 281 return network_configuration_handler_->PendingProfileEntryDeleterForTest( | 282 return network_configuration_handler_->PendingProfileEntryDeleterForTest( |
| 282 service_path); | 283 service_path); |
| 283 } | 284 } |
| 284 | 285 |
| 285 void CreateConfiguration(const std::string& service_path, | 286 void CreateConfiguration(const std::string& service_path, |
| 286 const base::DictionaryValue& properties) { | 287 const base::DictionaryValue& properties) { |
| 287 network_configuration_handler_->CreateShillConfiguration( | 288 network_configuration_handler_->CreateShillConfiguration( |
| 288 properties, NetworkConfigurationObserver::SOURCE_USER_ACTION, | 289 properties, NetworkConfigurationObserver::SOURCE_USER_ACTION, |
| 289 base::Bind(&StringResultCallback, service_path), | 290 base::Bind(&ServiceResultCallback, service_path), |
| 290 base::Bind(&ErrorCallback, false, std::string())); | 291 base::Bind(&ErrorCallback, false, std::string())); |
| 291 } | 292 } |
| 292 | 293 |
| 293 protected: | 294 protected: |
| 294 MockShillManagerClient* mock_manager_client_; | 295 MockShillManagerClient* mock_manager_client_; |
| 295 MockShillProfileClient* mock_profile_client_; | 296 MockShillProfileClient* mock_profile_client_; |
| 296 MockShillServiceClient* mock_service_client_; | 297 MockShillServiceClient* mock_service_client_; |
| 297 scoped_ptr<NetworkStateHandler> network_state_handler_; | 298 scoped_ptr<NetworkStateHandler> network_state_handler_; |
| 298 scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; | 299 scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; |
| 299 base::MessageLoopForUI message_loop_; | 300 base::MessageLoopForUI message_loop_; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void SuccessCallback(const std::string& callback_name) { | 519 void SuccessCallback(const std::string& callback_name) { |
| 519 success_callback_name_ = callback_name; | 520 success_callback_name_ = callback_name; |
| 520 } | 521 } |
| 521 | 522 |
| 522 void GetPropertiesCallback(const std::string& service_path, | 523 void GetPropertiesCallback(const std::string& service_path, |
| 523 const base::DictionaryValue& dictionary) { | 524 const base::DictionaryValue& dictionary) { |
| 524 get_properties_path_ = service_path; | 525 get_properties_path_ = service_path; |
| 525 get_properties_.reset(dictionary.DeepCopy()); | 526 get_properties_.reset(dictionary.DeepCopy()); |
| 526 } | 527 } |
| 527 | 528 |
| 528 void CreateConfigurationCallback(const std::string& service_path) { | 529 void CreateConfigurationCallback(const std::string& service_path, |
| 530 const std::string& guid) { |
| 529 create_service_path_ = service_path; | 531 create_service_path_ = service_path; |
| 530 } | 532 } |
| 531 | 533 |
| 532 void CreateTestConfiguration(const std::string& service_path, | 534 void CreateTestConfiguration(const std::string& service_path, |
| 533 const std::string& type) { | 535 const std::string& type) { |
| 534 base::DictionaryValue properties; | 536 base::DictionaryValue properties; |
| 535 shill_property_util::SetSSID(service_path, &properties); | 537 shill_property_util::SetSSID(service_path, &properties); |
| 536 properties.SetStringWithoutPathExpansion(shill::kNameProperty, | 538 properties.SetStringWithoutPathExpansion(shill::kNameProperty, |
| 537 service_path); | 539 service_path); |
| 538 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, | 540 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); | 745 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); |
| 744 EXPECT_FALSE(test_observer->HasConfigurationInProfile( | 746 EXPECT_FALSE(test_observer->HasConfigurationInProfile( |
| 745 service_path, NetworkProfileHandler::GetSharedProfilePath())); | 747 service_path, NetworkProfileHandler::GetSharedProfilePath())); |
| 746 EXPECT_FALSE( | 748 EXPECT_FALSE( |
| 747 test_observer->HasConfigurationInProfile(service_path, user_profile)); | 749 test_observer->HasConfigurationInProfile(service_path, user_profile)); |
| 748 | 750 |
| 749 network_configuration_handler_->RemoveObserver(test_observer.get()); | 751 network_configuration_handler_->RemoveObserver(test_observer.get()); |
| 750 } | 752 } |
| 751 | 753 |
| 752 } // namespace chromeos | 754 } // namespace chromeos |
| OLD | NEW |