| 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/extensions/api/test/test_api.h" | 5 #include "chrome/browser/extensions/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 AddRef(); // balanced in Reply | 100 AddRef(); // balanced in Reply |
| 101 content::NotificationService::current()->Notify( | 101 content::NotificationService::current()->Notify( |
| 102 chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 102 chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
| 103 content::Source<TestSendMessageFunction>(this), | 103 content::Source<TestSendMessageFunction>(this), |
| 104 content::Details<std::string>(&message)); | 104 content::Details<std::string>(&message)); |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 TestSendMessageFunction::~TestSendMessageFunction() {} | 107 TestSendMessageFunction::~TestSendMessageFunction() {} |
| 108 | 108 |
| 109 void TestSendMessageFunction::Reply(const std::string& message) { | 109 void TestSendMessageFunction::Reply(const std::string& message) { |
| 110 result_.reset(Value::CreateStringValue(message)); | 110 SetResult(Value::CreateStringValue(message)); |
| 111 SendResponse(true); | 111 SendResponse(true); |
| 112 Release(); // balanced in RunImpl | 112 Release(); // balanced in RunImpl |
| 113 } | 113 } |
| 114 | 114 |
| 115 // static | 115 // static |
| 116 void TestGetConfigFunction::set_test_config_state( | 116 void TestGetConfigFunction::set_test_config_state( |
| 117 DictionaryValue* value) { | 117 DictionaryValue* value) { |
| 118 TestConfigState* test_config_state = TestConfigState::GetInstance(); | 118 TestConfigState* test_config_state = TestConfigState::GetInstance(); |
| 119 test_config_state->set_config_state(value); | 119 test_config_state->set_config_state(value); |
| 120 } | 120 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 TestGetConfigFunction::~TestGetConfigFunction() {} | 131 TestGetConfigFunction::~TestGetConfigFunction() {} |
| 132 | 132 |
| 133 bool TestGetConfigFunction::RunImpl() { | 133 bool TestGetConfigFunction::RunImpl() { |
| 134 TestConfigState* test_config_state = TestConfigState::GetInstance(); | 134 TestConfigState* test_config_state = TestConfigState::GetInstance(); |
| 135 | 135 |
| 136 if (!test_config_state->config_state()) { | 136 if (!test_config_state->config_state()) { |
| 137 error_ = kNoTestConfigDataError; | 137 error_ = kNoTestConfigDataError; |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 | 140 |
| 141 result_.reset(test_config_state->config_state()->DeepCopy()); | 141 SetResult(test_config_state->config_state()->DeepCopy()); |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace extensions | 145 } // namespace extensions |
| OLD | NEW |