Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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/dhcp_provider.h" |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 6 | #include "shill/mock_glib.h" |
| 7 | |
| 8 | using testing::Test; |
| 9 | |
| 10 | namespace shill { |
| 11 | |
| 12 | namespace { |
| 13 | const char kDeviceName[] = "testdevicename"; |
| 14 | } // namespace {} |
| 15 | |
| 16 | class DHCPProviderTest : public Test { |
| 17 | public: |
Darin Petkov | f65e928 | 2011-06-21 14:29:56 -0700 | [diff] [blame] | 18 | DHCPProviderTest() : provider_(DHCPProvider::GetInstance()) { |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 19 | provider_->glib_ = &glib_; |
| 20 | } |
| 21 | |
| 22 | protected: |
| 23 | MockGLib glib_; |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 24 | DHCPProvider *provider_; |
| 25 | }; |
| 26 | |
| 27 | TEST_F(DHCPProviderTest, CreateConfig) { |
Darin Petkov | f65e928 | 2011-06-21 14:29:56 -0700 | [diff] [blame] | 28 | DHCPConfigRefPtr config = provider_->CreateConfig(kDeviceName); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 29 | EXPECT_TRUE(config.get()); |
| 30 | EXPECT_EQ(&glib_, config->glib_); |
Darin Petkov | f65e928 | 2011-06-21 14:29:56 -0700 | [diff] [blame] | 31 | EXPECT_EQ(kDeviceName, config->device_name()); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 32 | EXPECT_TRUE(provider_->configs_.empty()); |
| 33 | } |
| 34 | |
| 35 | } // namespace shill |