| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 12 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
| 13 #include "chrome/browser/notifications/notification_ui_manager.h" | 13 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
| 16 #include "extensions/browser/api/test/test_api.h" | 16 #include "extensions/browser/api/test/test_api.h" |
| 17 #include "extensions/browser/notification_types.h" | 17 #include "extensions/browser/notification_types.h" |
| 18 #include "extensions/common/features/feature.h" | 18 #include "extensions/common/features/feature.h" |
| 19 #include "extensions/test/result_catcher.h" |
| 19 #include "ui/message_center/message_center.h" | 20 #include "ui/message_center/message_center.h" |
| 20 #include "ui/message_center/notification_list.h" | 21 #include "ui/message_center/notification_list.h" |
| 21 #include "ui/message_center/notifier_settings.h" | 22 #include "ui/message_center/notifier_settings.h" |
| 22 | 23 |
| 23 using extensions::Extension; | 24 using extensions::Extension; |
| 25 using extensions::ResultCatcher; |
| 24 | 26 |
| 25 namespace utils = extension_function_test_utils; | 27 namespace utils = extension_function_test_utils; |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 // A class that waits for a |chrome.test.sendMessage| call, ignores the message, | 31 // A class that waits for a |chrome.test.sendMessage| call, ignores the message, |
| 30 // and writes down the user gesture status of the message. | 32 // and writes down the user gesture status of the message. |
| 31 class UserGestureCatcher : public content::NotificationObserver { | 33 class UserGestureCatcher : public content::NotificationObserver { |
| 32 public: | 34 public: |
| 33 UserGestureCatcher() : waiting_(false) { | 35 UserGestureCatcher() : waiting_(false) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 notification->ButtonClick(0); | 265 notification->ButtonClick(0); |
| 264 EXPECT_TRUE(catcher.GetNextResult()); | 266 EXPECT_TRUE(catcher.GetNextResult()); |
| 265 notification->Click(); | 267 notification->Click(); |
| 266 EXPECT_TRUE(catcher.GetNextResult()); | 268 EXPECT_TRUE(catcher.GetNextResult()); |
| 267 notification->Close(true); | 269 notification->Close(true); |
| 268 EXPECT_TRUE(catcher.GetNextResult()); | 270 EXPECT_TRUE(catcher.GetNextResult()); |
| 269 notification->Close(false); | 271 notification->Close(false); |
| 270 EXPECT_FALSE(catcher.GetNextResult()); | 272 EXPECT_FALSE(catcher.GetNextResult()); |
| 271 } | 273 } |
| 272 } | 274 } |
| OLD | NEW |