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 "chrome/browser/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
6 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 6 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_function_test_utils.h" | 8 #include "chrome/browser/extensions/extension_function_test_utils.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/extensions/features/feature.h" | 11 #include "chrome/common/extensions/features/feature.h" |
12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
14 #include "ui/message_center/message_center.h" | 14 #include "ui/message_center/message_center.h" |
15 #include "ui/message_center/message_center_util.h" | 15 #include "ui/message_center/message_center_util.h" |
16 | 16 |
17 // TODO(kbr): remove: http://crbug.com/222296 | |
18 // This can't be the first #include in the file. | |
Robert Sesek
2013/03/20 13:51:40
Why couldn't it be?
Regardless, I do think the pr
Ken Russell (switch to Gerrit)
2013/03/20 16:59:23
OS_MACOSX doesn't seem to be defined at that point
Robert Sesek
2013/03/20 17:00:20
Ah, makes sense.
| |
19 #if defined(OS_MACOSX) | |
20 #import "base/mac/mac_util.h" | |
21 #endif | |
22 | |
17 using extensions::Extension; | 23 using extensions::Extension; |
18 | 24 |
19 namespace utils = extension_function_test_utils; | 25 namespace utils = extension_function_test_utils; |
20 | 26 |
21 namespace { | 27 namespace { |
22 | 28 |
23 class NotificationsApiTest : public ExtensionApiTest { | 29 class NotificationsApiTest : public ExtensionApiTest { |
24 public: | 30 public: |
25 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 31 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
26 ExtensionApiTest::SetUpCommandLine(command_line); | 32 ExtensionApiTest::SetUpCommandLine(command_line); |
(...skipping 10 matching lines...) Expand all Loading... | |
37 if (extension) { | 43 if (extension) { |
38 page_created.Wait(); | 44 page_created.Wait(); |
39 } | 45 } |
40 return extension; | 46 return extension; |
41 } | 47 } |
42 }; | 48 }; |
43 | 49 |
44 } // namespace | 50 } // namespace |
45 | 51 |
46 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestIdUsage) { | 52 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestIdUsage) { |
53 #if defined(OS_MACOSX) | |
54 // TODO(kbr): re-enable: http://crbug.com/222296 | |
55 if (base::mac::IsOSMountainLionOrLater()) | |
56 return; | |
57 #endif | |
58 | |
47 // Create a new notification. A lingering output of this block is the | 59 // Create a new notification. A lingering output of this block is the |
48 // notifications ID, which we'll use in later parts of this test. | 60 // notifications ID, which we'll use in later parts of this test. |
49 std::string notification_id; | 61 std::string notification_id; |
50 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 62 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
51 { | 63 { |
52 scoped_refptr<extensions::NotificationsCreateFunction> | 64 scoped_refptr<extensions::NotificationsCreateFunction> |
53 notification_function( | 65 notification_function( |
54 new extensions::NotificationsCreateFunction()); | 66 new extensions::NotificationsCreateFunction()); |
55 | 67 |
56 notification_function->set_extension(empty_extension.get()); | 68 notification_function->set_extension(empty_extension.get()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 browser(), utils::NONE)); | 255 browser(), utils::NONE)); |
244 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] | 256 // TODO(dharcourt): [...], items = [{title: foo, message: bar}, ...], [...] |
245 | 257 |
246 std::string notification_id; | 258 std::string notification_id; |
247 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); | 259 ASSERT_EQ(base::Value::TYPE_STRING, result->GetType()); |
248 ASSERT_TRUE(result->GetAsString(¬ification_id)); | 260 ASSERT_TRUE(result->GetAsString(¬ification_id)); |
249 ASSERT_TRUE(notification_id.length() > 0); | 261 ASSERT_TRUE(notification_id.length() > 0); |
250 } | 262 } |
251 | 263 |
252 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestEvents) { | 264 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestEvents) { |
265 #if defined(OS_MACOSX) | |
266 // TODO(kbr): re-enable: http://crbug.com/222296 | |
267 if (base::mac::IsOSMountainLionOrLater()) | |
268 return; | |
269 #endif | |
270 | |
253 ASSERT_TRUE(RunExtensionTest("notifications/api/events")) << message_; | 271 ASSERT_TRUE(RunExtensionTest("notifications/api/events")) << message_; |
254 } | 272 } |
255 | 273 |
256 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestCSP) { | 274 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestCSP) { |
257 ASSERT_TRUE(RunExtensionTest("notifications/api/csp")) << message_; | 275 ASSERT_TRUE(RunExtensionTest("notifications/api/csp")) << message_; |
258 } | 276 } |
259 | 277 |
260 #ifdef ENABLE_MESSAGE_CENTER | 278 #ifdef ENABLE_MESSAGE_CENTER |
261 #if !defined(OS_WIN) || !defined(USE_ASH) | 279 #if !defined(OS_WIN) || !defined(USE_ASH) |
262 | 280 |
(...skipping 17 matching lines...) Expand all Loading... | |
280 ResultCatcher catcher; | 298 ResultCatcher catcher; |
281 g_browser_process->message_center()->SendRemoveNotification( | 299 g_browser_process->message_center()->SendRemoveNotification( |
282 extension->id() + "-BAR", | 300 extension->id() + "-BAR", |
283 true); | 301 true); |
284 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 302 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
285 } | 303 } |
286 } | 304 } |
287 | 305 |
288 #endif | 306 #endif |
289 #endif | 307 #endif |
OLD | NEW |