blob: b71a7e9fb28525205c6c37fc2358fc1940323d4e (
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
|
// Copyright (c) 2013 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.
#ifndef UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_
#define UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_
#include "ui/message_center/notifier_settings.h"
namespace message_center {
// A NotifierSettingsProvider that returns a configurable, fixed set of
// notifiers and records which callbacks were called. For use in tests.
class FakeNotifierSettingsProvider : public NotifierSettingsProvider {
public:
FakeNotifierSettingsProvider();
explicit FakeNotifierSettingsProvider(
const std::vector<Notifier*>& notifiers);
virtual ~FakeNotifierSettingsProvider();
virtual size_t GetNotifierGroupCount() const OVERRIDE;
virtual const message_center::NotifierGroup& GetNotifierGroupAt(
size_t index) const OVERRIDE;
virtual bool IsNotifierGroupActiveAt(size_t index) const OVERRIDE;
virtual void SwitchToNotifierGroup(size_t index) OVERRIDE;
virtual const message_center::NotifierGroup& GetActiveNotifierGroup() const
OVERRIDE;
virtual void GetNotifierList(std::vector<Notifier*>* notifiers) OVERRIDE;
virtual void SetNotifierEnabled(const Notifier& notifier,
bool enabled) OVERRIDE;
virtual void OnNotifierSettingsClosing() OVERRIDE;
virtual void AddObserver(NotifierSettingsObserver* observer) OVERRIDE;
virtual void RemoveObserver(NotifierSettingsObserver* observer) OVERRIDE;
bool WasEnabled(const Notifier& notifier);
int closed_called_count();
void AddGroup(NotifierGroup* group, const std::vector<Notifier*>& notifiers);
private:
struct NotifierGroupItem {
NotifierGroup* group;
std::vector<Notifier*> notifiers;
NotifierGroupItem();
~NotifierGroupItem();
};
std::map<const Notifier*, bool> enabled_;
std::vector<NotifierGroupItem> items_;
int closed_called_count_;
size_t active_item_index_;
};
} // namespace message_center
#endif // UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_
|