OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_notification_types.h" | 5 #include "chrome/browser/chrome_notification_types.h" |
6 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" | 6 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" |
7 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 7 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
8 #include "chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h" | 8 #include "chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h" |
9 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" | 9 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "content/public/browser/navigation_controller.h" | 14 #include "content/public/browser/navigation_controller.h" |
15 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
19 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
20 #include "sync/api/sync_change.h" | 20 #include "sync/api/sync_change.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "ui/message_center/notification_types.h" | 22 #include "ui/message_center/notification_types.h" |
23 | 23 |
24 namespace { | |
25 const char kTestNotificationId[] = "SomeRandomNotificationId"; | 24 const char kTestNotificationId[] = "SomeRandomNotificationId"; |
26 const int kNotificationPriority = static_cast<int>( | |
27 message_center::LOW_PRIORITY); | |
28 } // namespace | |
29 | 25 |
30 class StubChromeNotifierService : public notifier::ChromeNotifierService { | 26 class StubChromeNotifierService : public notifier::ChromeNotifierService { |
31 public: | 27 public: |
32 StubChromeNotifierService() | 28 StubChromeNotifierService() |
33 : ChromeNotifierService(ProfileManager::GetDefaultProfile(), NULL) {} | 29 : ChromeNotifierService(ProfileManager::GetDefaultProfile(), NULL) {} |
34 | 30 |
35 virtual ~StubChromeNotifierService() {} | 31 virtual ~StubChromeNotifierService() {} |
36 | 32 |
37 virtual void MarkNotificationAsRead(const std::string& id) OVERRIDE { | 33 virtual void MarkNotificationAsRead(const std::string& id) OVERRIDE { |
38 read_id_ = id; | 34 read_id_ = id; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 StubChromeNotifierService notifier; | 150 StubChromeNotifierService notifier; |
155 notifier::ChromeNotifierDelegate* delegate = | 151 notifier::ChromeNotifierDelegate* delegate = |
156 new notifier::ChromeNotifierDelegate(id, ¬ifier); | 152 new notifier::ChromeNotifierDelegate(id, ¬ifier); |
157 | 153 |
158 delegate->Close(false); | 154 delegate->Close(false); |
159 ASSERT_EQ("", notifier.read_id()); | 155 ASSERT_EQ("", notifier.read_id()); |
160 | 156 |
161 delegate->Close(true); | 157 delegate->Close(true); |
162 ASSERT_EQ(kTestNotificationId, notifier.read_id()); | 158 ASSERT_EQ(kTestNotificationId, notifier.read_id()); |
163 } | 159 } |
OLD | NEW |