OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <dbus/dbus-glib.h> | 8 #include <dbus/dbus-glib.h> |
9 #include <dbus/dbus-gtype-specialized.h> | 9 #include <dbus/dbus-gtype-specialized.h> |
10 #include <glib-object.h> | 10 #include <glib-object.h> |
(...skipping 4561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4572 NetworkDevice* cellular = new NetworkDevice("cellular"); | 4572 NetworkDevice* cellular = new NetworkDevice("cellular"); |
4573 cellular->type_ = TYPE_CELLULAR; | 4573 cellular->type_ = TYPE_CELLULAR; |
4574 cellular->imsi_ = "123456789012345"; | 4574 cellular->imsi_ = "123456789012345"; |
4575 device_map_["cellular"] = cellular; | 4575 device_map_["cellular"] = cellular; |
4576 | 4576 |
4577 // Networks | 4577 // Networks |
4578 DeleteNetworks(); | 4578 DeleteNetworks(); |
4579 | 4579 |
4580 ethernet_ = new EthernetNetwork("eth1"); | 4580 ethernet_ = new EthernetNetwork("eth1"); |
4581 ethernet_->set_connected(true); | 4581 ethernet_->set_connected(true); |
| 4582 // Note: We need exactly one network connected and active, otherwise |
| 4583 // browser_tests sometimes conclude we are offline and fail. |
| 4584 ethernet_->set_is_active(true); |
4582 AddNetwork(ethernet_); | 4585 AddNetwork(ethernet_); |
4583 | 4586 |
4584 WifiNetwork* wifi1 = new WifiNetwork("fw1"); | 4587 WifiNetwork* wifi1 = new WifiNetwork("fw1"); |
4585 wifi1->set_name("Fake WiFi Connected"); | 4588 wifi1->set_name("Fake WiFi Connected"); |
4586 wifi1->set_strength(90); | 4589 wifi1->set_strength(90); |
4587 wifi1->set_connected(false); | 4590 wifi1->set_connected(false); |
4588 wifi1->set_connecting(true); | 4591 wifi1->set_connecting(true); |
4589 wifi1->set_is_active(true); | |
4590 wifi1->set_encryption(SECURITY_NONE); | 4592 wifi1->set_encryption(SECURITY_NONE); |
4591 wifi1->set_profile_type(PROFILE_SHARED); | 4593 wifi1->set_profile_type(PROFILE_SHARED); |
4592 AddNetwork(wifi1); | 4594 AddNetwork(wifi1); |
4593 | 4595 |
4594 WifiNetwork* wifi2 = new WifiNetwork("fw2"); | 4596 WifiNetwork* wifi2 = new WifiNetwork("fw2"); |
4595 wifi2->set_name("Fake WiFi"); | 4597 wifi2->set_name("Fake WiFi"); |
4596 wifi2->set_strength(70); | 4598 wifi2->set_strength(70); |
4597 wifi2->set_connected(false); | 4599 wifi2->set_connected(false); |
4598 wifi2->set_encryption(SECURITY_NONE); | 4600 wifi2->set_encryption(SECURITY_NONE); |
4599 wifi2->set_profile_type(PROFILE_SHARED); | 4601 wifi2->set_profile_type(PROFILE_SHARED); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4633 wifi6->set_connected(false); | 4635 wifi6->set_connected(false); |
4634 AddNetwork(wifi6); | 4636 AddNetwork(wifi6); |
4635 | 4637 |
4636 active_wifi_ = wifi1; | 4638 active_wifi_ = wifi1; |
4637 | 4639 |
4638 CellularNetwork* cellular1 = new CellularNetwork("fc1"); | 4640 CellularNetwork* cellular1 = new CellularNetwork("fc1"); |
4639 cellular1->set_name("Fake Cellular"); | 4641 cellular1->set_name("Fake Cellular"); |
4640 cellular1->set_strength(70); | 4642 cellular1->set_strength(70); |
4641 cellular1->set_connected(false); | 4643 cellular1->set_connected(false); |
4642 cellular1->set_connecting(true); | 4644 cellular1->set_connecting(true); |
4643 cellular1->set_is_active(true); | |
4644 cellular1->set_activation_state(ACTIVATION_STATE_ACTIVATED); | 4645 cellular1->set_activation_state(ACTIVATION_STATE_ACTIVATED); |
4645 cellular1->set_payment_url(std::string("http://www.google.com")); | 4646 cellular1->set_payment_url(std::string("http://www.google.com")); |
4646 cellular1->set_usage_url(std::string("http://www.google.com")); | 4647 cellular1->set_usage_url(std::string("http://www.google.com")); |
4647 cellular1->set_network_technology(NETWORK_TECHNOLOGY_EVDO); | 4648 cellular1->set_network_technology(NETWORK_TECHNOLOGY_EVDO); |
4648 cellular1->set_roaming_state(ROAMING_STATE_ROAMING); | 4649 cellular1->set_roaming_state(ROAMING_STATE_ROAMING); |
4649 | 4650 |
4650 CellularDataPlan* base_plan = new CellularDataPlan(); | 4651 CellularDataPlan* base_plan = new CellularDataPlan(); |
4651 base_plan->plan_name = "Base plan"; | 4652 base_plan->plan_name = "Base plan"; |
4652 base_plan->plan_type = CELLULAR_DATA_PLAN_METERED_BASE; | 4653 base_plan->plan_type = CELLULAR_DATA_PLAN_METERED_BASE; |
4653 base_plan->plan_data_bytes = 100ll * 1024 * 1024; | 4654 base_plan->plan_data_bytes = 100ll * 1024 * 1024; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4840 return impl; | 4841 return impl; |
4841 } | 4842 } |
4842 | 4843 |
4843 ///////////////////////////////////////////////////////////////////////////// | 4844 ///////////////////////////////////////////////////////////////////////////// |
4844 | 4845 |
4845 } // namespace chromeos | 4846 } // namespace chromeos |
4846 | 4847 |
4847 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 4848 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
4848 // won't be deleted until its last InvokeLater is run. | 4849 // won't be deleted until its last InvokeLater is run. |
4849 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 4850 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |