1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
content / public / test / focus_changed_observer.cc [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/focus_changed_observer.h"
namespace content {
FocusChangedObserver::FocusChangedObserver(WebContents* web_contents)
: WebContentsObserver(web_contents) {
DCHECK(web_contents);
}
FocusChangedObserver::~FocusChangedObserver() = default;
FocusedNodeDetails FocusChangedObserver::Wait() {
run_loop_.Run();
DCHECK(observed_details_.has_value());
return *observed_details_;
}
void FocusChangedObserver::OnFocusChangedInPage(FocusedNodeDetails* details) {
DCHECK(details);
observed_details_ = *details;
run_loop_.Quit();
}
} // namespace content