| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/extension_test_api.h" | 5 #include "chrome/browser/extensions/extension_test_api.h" |
| 6 #include "chrome/common/notification_service.h" | 6 #include "chrome/common/notification_service.h" |
| 7 | 7 |
| 8 namespace extension_test_api_functions { | |
| 9 const char kPassFunction[] = "test.notifyPass"; | |
| 10 const char kFailFunction[] = "test.notifyFail"; | |
| 11 const char kLogFunction[] = "test.log"; | |
| 12 }; // namespace extension_test_api_functions | |
| 13 | |
| 14 bool ExtensionTestPassFunction::RunImpl() { | 8 bool ExtensionTestPassFunction::RunImpl() { |
| 15 NotificationService::current()->Notify( | 9 NotificationService::current()->Notify( |
| 16 NotificationType::EXTENSION_TEST_PASSED, | 10 NotificationType::EXTENSION_TEST_PASSED, |
| 17 Source<Profile>(dispatcher()->profile()), | 11 Source<Profile>(dispatcher()->profile()), |
| 18 NotificationService::NoDetails()); | 12 NotificationService::NoDetails()); |
| 19 return true; | 13 return true; |
| 20 } | 14 } |
| 21 | 15 |
| 22 bool ExtensionTestFailFunction::RunImpl() { | 16 bool ExtensionTestFailFunction::RunImpl() { |
| 23 std::string message; | 17 std::string message; |
| 24 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message)); | 18 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message)); |
| 25 NotificationService::current()->Notify( | 19 NotificationService::current()->Notify( |
| 26 NotificationType::EXTENSION_TEST_FAILED, | 20 NotificationType::EXTENSION_TEST_FAILED, |
| 27 Source<Profile>(dispatcher()->profile()), | 21 Source<Profile>(dispatcher()->profile()), |
| 28 Details<std::string>(&message)); | 22 Details<std::string>(&message)); |
| 29 return true; | 23 return true; |
| 30 } | 24 } |
| 31 | 25 |
| 32 bool ExtensionTestLogFunction::RunImpl() { | 26 bool ExtensionTestLogFunction::RunImpl() { |
| 33 std::string message; | 27 std::string message; |
| 34 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message)); | 28 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&message)); |
| 35 printf("%s\n", message.c_str()); | 29 printf("%s\n", message.c_str()); |
| 36 LOG(INFO) << message; | 30 LOG(INFO) << message; |
| 37 return true; | 31 return true; |
| 38 } | 32 } |
| OLD | NEW |