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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 ToCharVector(kStartTracingAck)); | 1079 ToCharVector(kStartTracingAck)); |
1080 | 1080 |
1081 EXPECT_FALSE(IsCommandComplete()); | 1081 EXPECT_FALSE(IsCommandComplete()); |
1082 | 1082 |
1083 RunGetFirmwareGitHashTo(BattOrAgentState::READ_GIT_HASH_RECEIVED); | 1083 RunGetFirmwareGitHashTo(BattOrAgentState::READ_GIT_HASH_RECEIVED); |
1084 | 1084 |
1085 EXPECT_TRUE(IsCommandComplete()); | 1085 EXPECT_TRUE(IsCommandComplete()); |
1086 EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); | 1086 EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
1087 } | 1087 } |
1088 } // namespace battor | 1088 } // namespace battor |
OLD | NEW |