Skip to content

Commit

Permalink
login: use the same observer list between real and fake session_manag…
Browse files Browse the repository at this point in the history
…er_client

In https://crrev.com/c/2459528 we added a test for container_client_adapter that uses fake session_manager_client therefore we need to ensure that fake works the same way as real.

BUG=b:164816080
TEST=components_unittests --gtest_filter='ArcContainerClientAdapterTest*'
TEST=revert the fix and ensure that the test fails

Change-Id: I271d116d10387cb6b5967378bab3fdea508d6581
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461603
Auto-Submit: Muhammad Hasan Khan <mhasank@chromium.org>
Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Yusuke Sato <yusukes@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816910}
  • Loading branch information
Muhammad Hasan Khan authored and Commit Bot committed Oct 14, 2020
1 parent 0973465 commit 7ef12b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion chromeos/dbus/session_manager/fake_session_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ class COMPONENT_EXPORT(SESSION_MANAGER) FakeSessionManagerClient
// requested restarted arguments.
base::Optional<std::vector<std::string>> restart_job_argv_;

base::ObserverList<Observer>::Unchecked observers_;
base::ObserverList<Observer>::Unchecked observers_{
SessionManagerClient::kObserverListPolicy};
SessionManagerClient::ActiveSessionsMap user_sessions_;
std::vector<std::string> server_backed_state_keys_;

Expand Down
2 changes: 1 addition & 1 deletion chromeos/dbus/session_manager/session_manager_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
dbus::ObjectProxy* session_manager_proxy_ = nullptr;
std::unique_ptr<BlockingMethodCaller> blocking_method_caller_;
base::ObserverList<Observer>::Unchecked observers_{
base::ObserverListPolicy::EXISTING_ONLY};
SessionManagerClient::kObserverListPolicy};

// Most recent screen-lock state received from session_manager.
bool screen_is_locked_ = false;
Expand Down
3 changes: 3 additions & 0 deletions chromeos/dbus/session_manager/session_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ namespace chromeos {
// SessionManagerClient is used to communicate with the session manager.
class COMPONENT_EXPORT(SESSION_MANAGER) SessionManagerClient {
public:
static constexpr base::ObserverListPolicy kObserverListPolicy =
base::ObserverListPolicy::EXISTING_ONLY;

// The result type received from session manager on request to retrieve the
// policy. Used to define the buckets for an enumerated UMA histogram.
// Hence,
Expand Down

0 comments on commit 7ef12b9

Please sign in to comment.