blob: 644c1b1de04ca0e0b046851beffecaa8a6167a6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/sync_driver/local_device_info_provider_mock.h"
namespace sync_driver {
LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock()
: is_initialized_(false) {}
LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock(
const std::string& guid,
const std::string& client_name,
const std::string& chrome_version,
const std::string& sync_user_agent,
const sync_pb::SyncEnums::DeviceType device_type,
const std::string& signin_scoped_device_id)
: is_initialized_(true) {
local_device_info_.reset(
new DeviceInfo(
guid,
client_name,
chrome_version,
sync_user_agent,
device_type,
signin_scoped_device_id));
}
LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {}
const DeviceInfo* LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const {
return is_initialized_ ? local_device_info_.get() : NULL;
}
std::string LocalDeviceInfoProviderMock::GetSyncUserAgent() const {
return "useragent";
}
std::string LocalDeviceInfoProviderMock::GetLocalSyncCacheGUID() const {
return local_device_info_.get() ? local_device_info_->guid() : "";
}
void LocalDeviceInfoProviderMock::Initialize(
const std::string& cache_guid, const std::string& signin_scoped_device_id) {
// Ignored for the mock provider.
}
scoped_ptr<LocalDeviceInfoProvider::Subscription>
LocalDeviceInfoProviderMock::RegisterOnInitializedCallback(
const base::Closure& callback) {
DCHECK(!is_initialized_);
return callback_list_.Add(callback);
}
void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) {
is_initialized_ = is_initialized;
if (is_initialized_) {
callback_list_.Notify();
}
}
} // namespace sync_driver
|