blob: 14103dff0e9dbd13875971dcbf7a83aab4639108 [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"
Darin Petkov98dd6a02011-06-10 15:12:57 -07006#include "shill/mock_glib.h"
7
8using testing::Test;
9
10namespace shill {
11
12namespace {
13const char kDeviceName[] = "testdevicename";
14} // namespace {}
15
16class DHCPProviderTest : public Test {
17 public:
Darin Petkovf65e9282011-06-21 14:29:56 -070018 DHCPProviderTest() : provider_(DHCPProvider::GetInstance()) {
Darin Petkov98dd6a02011-06-10 15:12:57 -070019 provider_->glib_ = &glib_;
20 }
21
22 protected:
23 MockGLib glib_;
Darin Petkov98dd6a02011-06-10 15:12:57 -070024 DHCPProvider *provider_;
25};
26
27TEST_F(DHCPProviderTest, CreateConfig) {
Darin Petkovf65e9282011-06-21 14:29:56 -070028 DHCPConfigRefPtr config = provider_->CreateConfig(kDeviceName);
Darin Petkov98dd6a02011-06-10 15:12:57 -070029 EXPECT_TRUE(config.get());
30 EXPECT_EQ(&glib_, config->glib_);
Darin Petkovf65e9282011-06-21 14:29:56 -070031 EXPECT_EQ(kDeviceName, config->device_name());
Darin Petkov98dd6a02011-06-10 15:12:57 -070032 EXPECT_TRUE(provider_->configs_.empty());
33}
34
35} // namespace shill