mukesh agrawal | 9da0777 | 2013-05-15 14:15:17 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/virtual_device.h" |
| 6 | |
| 7 | #include <gtest/gtest.h> |
| 8 | |
| 9 | #include "shill/event_dispatcher.h" |
| 10 | #include "shill/mock_glib.h" |
| 11 | #include "shill/mock_manager.h" |
| 12 | #include "shill/mock_metrics.h" |
| 13 | #include "shill/nice_mock_control.h" |
| 14 | #include "shill/technology.h" |
| 15 | |
| 16 | namespace shill { |
| 17 | |
mukesh agrawal | a8f7c49 | 2013-06-13 18:31:14 -0700 | [diff] [blame] | 18 | namespace { |
| 19 | const char kTestDeviceName[] = "tun0"; |
| 20 | const int kTestInterfaceIndex = 5; |
| 21 | } // namespace {} |
| 22 | |
mukesh agrawal | 9da0777 | 2013-05-15 14:15:17 -0700 | [diff] [blame] | 23 | class VirtualDeviceTest : public testing::Test { |
| 24 | public: |
| 25 | VirtualDeviceTest() |
| 26 | : metrics_(&dispatcher_), |
| 27 | manager_(&control_, &dispatcher_, &metrics_, &glib_), |
| 28 | device_(new VirtualDevice(&control_, |
| 29 | &dispatcher_, |
| 30 | &metrics_, |
| 31 | &manager_, |
| 32 | kTestDeviceName, |
| 33 | kTestInterfaceIndex, |
| 34 | Technology::kVPN)) {} |
| 35 | |
| 36 | virtual ~VirtualDeviceTest() {} |
| 37 | |
| 38 | protected: |
mukesh agrawal | 9da0777 | 2013-05-15 14:15:17 -0700 | [diff] [blame] | 39 | NiceMockControl control_; |
| 40 | EventDispatcher dispatcher_; |
| 41 | MockMetrics metrics_; |
| 42 | MockGLib glib_; |
| 43 | MockManager manager_; |
| 44 | |
| 45 | VirtualDeviceRefPtr device_; |
| 46 | }; |
| 47 | |
mukesh agrawal | 9da0777 | 2013-05-15 14:15:17 -0700 | [diff] [blame] | 48 | TEST_F(VirtualDeviceTest, technology) { |
| 49 | EXPECT_EQ(Technology::kVPN, device_->technology()); |
| 50 | EXPECT_NE(Technology::kEthernet, device_->technology()); |
| 51 | } |
| 52 | |
| 53 | } // namespace shill |