| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 TestSendMessageFunction::~TestSendMessageFunction() {} | 117 TestSendMessageFunction::~TestSendMessageFunction() {} |
| 118 | 118 |
| 119 void TestSendMessageFunction::Reply(const std::string& message) { | 119 void TestSendMessageFunction::Reply(const std::string& message) { |
| 120 SetResult(Value::CreateStringValue(message)); | 120 SetResult(Value::CreateStringValue(message)); |
| 121 SendResponse(true); | 121 SendResponse(true); |
| 122 Release(); // balanced in RunImpl | 122 Release(); // balanced in RunImpl |
| 123 } | 123 } |
| 124 | 124 |
| 125 // static | 125 // static |
| 126 void TestGetConfigFunction::set_test_config_state( | 126 void TestGetConfigFunction::set_test_config_state( |
| 127 DictionaryValue* value) { | 127 base::DictionaryValue* value) { |
| 128 TestConfigState* test_config_state = TestConfigState::GetInstance(); | 128 TestConfigState* test_config_state = TestConfigState::GetInstance(); |
| 129 test_config_state->set_config_state(value); | 129 test_config_state->set_config_state(value); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TestGetConfigFunction::TestConfigState::TestConfigState() | 132 TestGetConfigFunction::TestConfigState::TestConfigState() |
| 133 : config_state_(NULL) {} | 133 : config_state_(NULL) {} |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 TestGetConfigFunction::TestConfigState* | 136 TestGetConfigFunction::TestConfigState* |
| 137 TestGetConfigFunction::TestConfigState::GetInstance() { | 137 TestGetConfigFunction::TestConfigState::GetInstance() { |
| 138 return Singleton<TestConfigState>::get(); | 138 return Singleton<TestConfigState>::get(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 TestGetConfigFunction::~TestGetConfigFunction() {} | 141 TestGetConfigFunction::~TestGetConfigFunction() {} |
| 142 | 142 |
| 143 bool TestGetConfigFunction::RunImpl() { | 143 bool TestGetConfigFunction::RunImpl() { |
| 144 TestConfigState* test_config_state = TestConfigState::GetInstance(); | 144 TestConfigState* test_config_state = TestConfigState::GetInstance(); |
| 145 | 145 |
| 146 if (!test_config_state->config_state()) { | 146 if (!test_config_state->config_state()) { |
| 147 error_ = kNoTestConfigDataError; | 147 error_ = kNoTestConfigDataError; |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 SetResult(test_config_state->config_state()->DeepCopy()); | 151 SetResult(test_config_state->config_state()->DeepCopy()); |
| 152 return true; | 152 return true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |