| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/test/test_api.h" | 5 #include "extensions/browser/api/test/test_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 content::NotificationService::current()->Notify( | 51 content::NotificationService::current()->Notify( |
| 52 extensions::NOTIFICATION_EXTENSION_TEST_PASSED, | 52 extensions::NOTIFICATION_EXTENSION_TEST_PASSED, |
| 53 content::Source<content::BrowserContext>(dispatcher()->browser_context()), | 53 content::Source<content::BrowserContext>(dispatcher()->browser_context()), |
| 54 content::NotificationService::NoDetails()); | 54 content::NotificationService::NoDetails()); |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 TestNotifyFailFunction::~TestNotifyFailFunction() {} | 58 TestNotifyFailFunction::~TestNotifyFailFunction() {} |
| 59 | 59 |
| 60 bool TestNotifyFailFunction::RunSafe() { | 60 bool TestNotifyFailFunction::RunSafe() { |
| 61 scoped_ptr<NotifyFail::Params> params(NotifyFail::Params::Create(*args_)); | 61 std::unique_ptr<NotifyFail::Params> params( |
| 62 NotifyFail::Params::Create(*args_)); |
| 62 EXTENSION_FUNCTION_VALIDATE(params.get()); | 63 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 63 content::NotificationService::current()->Notify( | 64 content::NotificationService::current()->Notify( |
| 64 extensions::NOTIFICATION_EXTENSION_TEST_FAILED, | 65 extensions::NOTIFICATION_EXTENSION_TEST_FAILED, |
| 65 content::Source<content::BrowserContext>(dispatcher()->browser_context()), | 66 content::Source<content::BrowserContext>(dispatcher()->browser_context()), |
| 66 content::Details<std::string>(¶ms->message)); | 67 content::Details<std::string>(¶ms->message)); |
| 67 return true; | 68 return true; |
| 68 } | 69 } |
| 69 | 70 |
| 70 TestLogFunction::~TestLogFunction() {} | 71 TestLogFunction::~TestLogFunction() {} |
| 71 | 72 |
| 72 bool TestLogFunction::RunSafe() { | 73 bool TestLogFunction::RunSafe() { |
| 73 scoped_ptr<Log::Params> params(Log::Params::Create(*args_)); | 74 std::unique_ptr<Log::Params> params(Log::Params::Create(*args_)); |
| 74 EXTENSION_FUNCTION_VALIDATE(params.get()); | 75 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 75 VLOG(1) << params->message; | 76 VLOG(1) << params->message; |
| 76 return true; | 77 return true; |
| 77 } | 78 } |
| 78 | 79 |
| 79 bool TestSendMessageFunction::RunAsync() { | 80 bool TestSendMessageFunction::RunAsync() { |
| 80 scoped_ptr<PassMessage::Params> params(PassMessage::Params::Create(*args_)); | 81 std::unique_ptr<PassMessage::Params> params( |
| 82 PassMessage::Params::Create(*args_)); |
| 81 EXTENSION_FUNCTION_VALIDATE(params.get()); | 83 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 82 content::NotificationService::current()->Notify( | 84 content::NotificationService::current()->Notify( |
| 83 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 85 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
| 84 content::Source<TestSendMessageFunction>(this), | 86 content::Source<TestSendMessageFunction>(this), |
| 85 content::Details<std::string>(¶ms->message)); | 87 content::Details<std::string>(¶ms->message)); |
| 86 return true; | 88 return true; |
| 87 } | 89 } |
| 88 | 90 |
| 89 TestSendMessageFunction::~TestSendMessageFunction() {} | 91 TestSendMessageFunction::~TestSendMessageFunction() {} |
| 90 | 92 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return false; | 126 return false; |
| 125 } | 127 } |
| 126 | 128 |
| 127 SetResult(test_config_state->config_state()->DeepCopy()); | 129 SetResult(test_config_state->config_state()->DeepCopy()); |
| 128 return true; | 130 return true; |
| 129 } | 131 } |
| 130 | 132 |
| 131 TestWaitForRoundTripFunction::~TestWaitForRoundTripFunction() {} | 133 TestWaitForRoundTripFunction::~TestWaitForRoundTripFunction() {} |
| 132 | 134 |
| 133 bool TestWaitForRoundTripFunction::RunSafe() { | 135 bool TestWaitForRoundTripFunction::RunSafe() { |
| 134 scoped_ptr<WaitForRoundTrip::Params> params( | 136 std::unique_ptr<WaitForRoundTrip::Params> params( |
| 135 WaitForRoundTrip::Params::Create(*args_)); | 137 WaitForRoundTrip::Params::Create(*args_)); |
| 136 SetResult(new base::StringValue(params->message)); | 138 SetResult(new base::StringValue(params->message)); |
| 137 return true; | 139 return true; |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace extensions | 142 } // namespace extensions |
| OLD | NEW |