| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "tools/battor_agent/battor_agent.h" | 7 #include "tools/battor_agent/battor_agent.h" |
| 8 | 8 |
| 9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 private: | 75 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(MockBattOrConnection); | 76 DISALLOW_COPY_AND_ASSIGN(MockBattOrConnection); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 // TestableBattOrAgent uses a fake BattOrConnection to be testable. | 81 // TestableBattOrAgent uses a fake BattOrConnection to be testable. |
| 82 class TestableBattOrAgent : public BattOrAgent { | 82 class TestableBattOrAgent : public BattOrAgent { |
| 83 public: | 83 public: |
| 84 TestableBattOrAgent(BattOrAgent::Listener* listener) | 84 TestableBattOrAgent(BattOrAgent::Listener* listener) |
| 85 : BattOrAgent("/dev/test", listener, nullptr, nullptr) { | 85 : BattOrAgent("/dev/test", listener, nullptr) { |
| 86 connection_ = | 86 connection_ = |
| 87 std::unique_ptr<BattOrConnection>(new MockBattOrConnection(this)); | 87 std::unique_ptr<BattOrConnection>(new MockBattOrConnection(this)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 MockBattOrConnection* GetConnection() { | 90 MockBattOrConnection* GetConnection() { |
| 91 return static_cast<MockBattOrConnection*>(connection_.get()); | 91 return static_cast<MockBattOrConnection*>(connection_.get()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void OnActionTimeout() override {} | 94 void OnActionTimeout() override {} |
| 95 }; | 95 }; |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1031 |
| 1032 EXPECT_FALSE(IsCommandComplete()); | 1032 EXPECT_FALSE(IsCommandComplete()); |
| 1033 | 1033 |
| 1034 RunGetFirmwareGitHashTo(BattOrAgentState::READ_GIT_HASH_RECEIVED); | 1034 RunGetFirmwareGitHashTo(BattOrAgentState::READ_GIT_HASH_RECEIVED); |
| 1035 | 1035 |
| 1036 EXPECT_TRUE(IsCommandComplete()); | 1036 EXPECT_TRUE(IsCommandComplete()); |
| 1037 EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); | 1037 EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 } // namespace battor | 1040 } // namespace battor |
| OLD | NEW |