Chromium Code Reviews| Index: remoting/protocol/fake_authenticator.h |
| diff --git a/remoting/protocol/fake_authenticator.h b/remoting/protocol/fake_authenticator.h |
| index 8d0ac2f21d18873771d5a81f0e0123414ed375eb..2302ed8238031970d8c6bde22daeb88ae0f8aeca 100644 |
| --- a/remoting/protocol/fake_authenticator.h |
| +++ b/remoting/protocol/fake_authenticator.h |
| @@ -56,7 +56,24 @@ class FakeAuthenticator : public Authenticator { |
| REJECT_CHANNEL |
| }; |
| - FakeAuthenticator(Type type, int round_trips, Action action, bool async); |
| + struct Config { |
| + Config(); |
| + Config(Action action); |
| + Config(int round_trips, Action action, bool async); |
| + |
| + int round_trips = 1; |
| + Action action = Action::ACCEPT; |
| + bool async = false; |
| + }; |
| + |
| + FakeAuthenticator(Type type, |
| + Config config, |
| + const std::string& local_id, |
| + const std::string& remote_id); |
| + |
| + // Special constructor for authenticators in ACCEPTED or REJECTED state that |
| + // don't exchange any messages. |
| + FakeAuthenticator(Action action); |
| ~FakeAuthenticator() override; |
| @@ -89,9 +106,9 @@ class FakeAuthenticator : public Authenticator { |
| protected: |
| const Type type_; |
| - const int round_trips_; |
| - const Action action_; |
| - const bool async_; |
| + const Config config_; |
| + const std::string local_id_; |
| + const std::string remote_id_; |
| // Total number of messages that have been processed. |
| int messages_ = 0; |
| @@ -109,9 +126,8 @@ class FakeAuthenticator : public Authenticator { |
| class FakeHostAuthenticatorFactory : public AuthenticatorFactory { |
| public: |
| - FakeHostAuthenticatorFactory( |
| - int round_trips, int messages_till_start, |
| - FakeAuthenticator::Action action, bool async); |
| + FakeHostAuthenticatorFactory(int messages_till_start, |
| + FakeAuthenticator::Config config); |
|
joedow
2017/04/11 16:20:34
nit: Config struct passed by const ref?
Sergey Ulanov
2017/04/11 21:14:20
That struct is only 12 bytes, not much bigger than
|
| ~FakeHostAuthenticatorFactory() override; |
| // AuthenticatorFactory interface. |
| @@ -120,10 +136,8 @@ class FakeHostAuthenticatorFactory : public AuthenticatorFactory { |
| const std::string& remote_jid) override; |
| private: |
| - const int round_trips_; |
| const int messages_till_started_; |
| - const FakeAuthenticator::Action action_; |
| - const bool async_; |
| + const FakeAuthenticator::Config config_; |
| DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
| }; |