1 // Copyright (c) 2013 The Chromium 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.
5 #ifndef UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_
6 #define UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_
8 #include "ui/message_center/notifier_settings.h"
10 namespace message_center
{
12 // A NotifierSettingsProvider that returns a configurable, fixed set of
13 // notifiers and records which callbacks were called. For use in tests.
14 class FakeNotifierSettingsProvider
: public NotifierSettingsProvider
{
16 FakeNotifierSettingsProvider();
17 FakeNotifierSettingsProvider(const std::vector
<Notifier
*>& notifiers
);
18 virtual ~FakeNotifierSettingsProvider();
20 virtual size_t GetNotifierGroupCount() const OVERRIDE
;
21 virtual const message_center::NotifierGroup
& GetNotifierGroupAt(
22 size_t index
) const OVERRIDE
;
23 virtual bool IsNotifierGroupActiveAt(size_t index
) const OVERRIDE
;
24 virtual void SwitchToNotifierGroup(size_t index
) OVERRIDE
;
25 virtual const message_center::NotifierGroup
& GetActiveNotifierGroup() const
28 virtual void GetNotifierList(std::vector
<Notifier
*>* notifiers
) OVERRIDE
;
30 virtual void SetNotifierEnabled(const Notifier
& notifier
,
31 bool enabled
) OVERRIDE
;
33 virtual void OnNotifierSettingsClosing() OVERRIDE
;
34 virtual void AddObserver(NotifierSettingsObserver
* observer
) OVERRIDE
;
35 virtual void RemoveObserver(NotifierSettingsObserver
* observer
) OVERRIDE
;
37 bool WasEnabled(const Notifier
& notifier
);
38 int closed_called_count();
40 void AddGroup(NotifierGroup
* group
, const std::vector
<Notifier
*>& notifiers
);
43 struct NotifierGroupItem
{
45 std::vector
<Notifier
*> notifiers
;
51 std::map
<const Notifier
*, bool> enabled_
;
52 std::vector
<NotifierGroupItem
> items_
;
53 int closed_called_count_
;
54 size_t active_item_index_
;
57 } // namespace message_center
59 #endif // UI_MESSAGE_CENTER_FAKE_NOTIFIER_SETTINGS_PROVIDER_H_