blob: e36643afb4510f16bceaa41364e380817c6e6a3d [file] [log] [blame]
Darin Petkov98dd6a02011-06-10 15:12:57 -07001// 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"
6#include "shill/mock_control.h"
7#include "shill/mock_device.h"
8#include "shill/mock_glib.h"
9
10using testing::Test;
11
12namespace shill {
13
14namespace {
15const char kDeviceName[] = "testdevicename";
16} // namespace {}
17
18class DHCPProviderTest : public Test {
19 public:
20 DHCPProviderTest()
21 : device_(new MockDevice(&control_interface_,
22 NULL,
23 NULL,
24 kDeviceName,
25 0)),
26 provider_(DHCPProvider::GetInstance()) {
27 provider_->glib_ = &glib_;
28 }
29
30 protected:
31 MockGLib glib_;
32 MockControl control_interface_;
33 scoped_refptr<MockDevice> device_;
34 DHCPProvider *provider_;
35};
36
37TEST_F(DHCPProviderTest, CreateConfig) {
38 DHCPConfigRefPtr config = provider_->CreateConfig(device_);
39 EXPECT_TRUE(config.get());
40 EXPECT_EQ(&glib_, config->glib_);
41 EXPECT_EQ(kDeviceName, config->GetDeviceName());
42 EXPECT_TRUE(provider_->configs_.empty());
43}
44
45} // namespace shill