forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and reenable TelemetryLogWriter unit tests.
This was originally postponed to make the branch deadline. Bug: 968640 Change-Id: I5066bd1f161e25428f872819bfc92bb16f4c7c35 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1668070 Commit-Queue: Erik Jensen <rkjnsn@chromium.org> Reviewed-by: Yuwei Huang <yuweih@chromium.org> Reviewed-by: Joe Downing <joedow@chromium.org> Cr-Commit-Position: refs/heads/master@{#792002}
- Loading branch information
Erik Jensen
authored and
Commit Bot
committed
Jul 27, 2020
1 parent
3e029cf
commit 1ea0101
Showing
20 changed files
with
316 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
remoting/base/grpc_test_support/fake_client_async_response_reader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef REMOTING_BASE_GRPC_TEST_SUPPORT_FAKE_CLIENT_ASYNC_RESPONSE_READER_H_ | ||
#define REMOTING_BASE_GRPC_TEST_SUPPORT_FAKE_CLIENT_ASYNC_RESPONSE_READER_H_ | ||
|
||
#include <utility> | ||
|
||
#include "base/callback.h" | ||
#include "third_party/grpc/src/include/grpc/support/time.h" | ||
#include "third_party/grpc/src/include/grpcpp/alarm.h" | ||
#include "third_party/grpc/src/include/grpcpp/completion_queue.h" | ||
#include "third_party/grpc/src/include/grpcpp/support/async_unary_call.h" | ||
#include "third_party/grpc/src/include/grpcpp/support/status.h" | ||
|
||
namespace remoting { | ||
namespace test { | ||
|
||
// Converts asynchronous stub calls to synchronous stub calls. Useful when | ||
// creating mock StubInterface implementations: only the synchronous ops need to | ||
// be mocked, while the async ops can return an instance of this class. | ||
template <typename Response> | ||
class FakeClientAsyncResponseReader | ||
: public grpc::ClientAsyncResponseReaderInterface<Response> { | ||
public: | ||
using SynchronousOp = base::OnceCallback<grpc::Status(Response* response)>; | ||
FakeClientAsyncResponseReader(SynchronousOp synchronous_op, | ||
grpc::CompletionQueue* completion_queue, | ||
bool start) | ||
: synchronous_op_(std::move(synchronous_op)), | ||
completion_queue_(completion_queue), | ||
started_(start) {} | ||
|
||
~FakeClientAsyncResponseReader() override = default; | ||
|
||
void StartCall() override { | ||
DCHECK(!started_); | ||
started_ = true; | ||
} | ||
|
||
void ReadInitialMetadata(void* tag) override { | ||
alarm_.Set(completion_queue_, gpr_now(GPR_CLOCK_MONOTONIC), tag); | ||
} | ||
|
||
void Finish(Response* msg, grpc::Status* status, void* tag) override { | ||
DCHECK(started_); | ||
*status = std::move(synchronous_op_).Run(msg); | ||
alarm_.Set(completion_queue_, gpr_now(GPR_CLOCK_MONOTONIC), tag); | ||
} | ||
|
||
private: | ||
SynchronousOp synchronous_op_; | ||
grpc::CompletionQueue* completion_queue_; | ||
grpc::Alarm alarm_; | ||
bool started_; | ||
}; | ||
|
||
} // namespace test | ||
} // namespace remoting | ||
|
||
#endif // REMOTING_BASE_GRPC_TEST_SUPPORT_FAKE_CLIENT_ASYNC_RESPONSE_READER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.