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/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 8 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
11 #include "chrome/common/chrome_switches.h" | |
12 #include "chrome/common/extensions/features/feature.h" | 11 #include "chrome/common/extensions/features/feature.h" |
13 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
14 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
15 #include "ui/message_center/message_center.h" | 14 #include "ui/message_center/message_center.h" |
16 #include "ui/message_center/message_center_switches.h" | 15 #include "ui/message_center/message_center_switches.h" |
17 #include "ui/message_center/message_center_util.h" | 16 #include "ui/message_center/message_center_util.h" |
18 | 17 |
19 // TODO(kbr): remove: http://crbug.com/222296 | 18 // TODO(kbr): remove: http://crbug.com/222296 |
20 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
21 #import "base/mac/mac_util.h" | 20 #import "base/mac/mac_util.h" |
22 #endif | 21 #endif |
23 | 22 |
24 using extensions::Extension; | 23 using extensions::Extension; |
25 | 24 |
26 namespace utils = extension_function_test_utils; | 25 namespace utils = extension_function_test_utils; |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
30 class NotificationsApiTest : public ExtensionApiTest { | 29 class NotificationsApiTest : public ExtensionApiTest { |
31 public: | 30 public: |
32 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
33 ExtensionApiTest::SetUpCommandLine(command_line); | |
34 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | |
35 } | |
36 | |
37 const extensions::Extension* LoadExtensionAndWait( | 31 const extensions::Extension* LoadExtensionAndWait( |
38 const std::string& test_name) { | 32 const std::string& test_name) { |
39 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); | 33 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); |
40 content::WindowedNotificationObserver page_created( | 34 content::WindowedNotificationObserver page_created( |
41 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, | 35 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, |
42 content::NotificationService::AllSources()); | 36 content::NotificationService::AllSources()); |
43 const extensions::Extension* extension = LoadExtension(extdir); | 37 const extensions::Extension* extension = LoadExtension(extdir); |
44 if (extension) { | 38 if (extension) { |
45 page_created.Wait(); | 39 page_created.Wait(); |
46 } | 40 } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 "}]", | 710 "}]", |
717 browser(), | 711 browser(), |
718 utils::NONE)); | 712 utils::NONE)); |
719 | 713 |
720 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 714 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
721 bool copy_bool_value = false; | 715 bool copy_bool_value = false; |
722 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); | 716 ASSERT_TRUE(result->GetAsBoolean(©_bool_value)); |
723 ASSERT_TRUE(copy_bool_value); | 717 ASSERT_TRUE(copy_bool_value); |
724 } | 718 } |
725 } | 719 } |
OLD | NEW |