Commit afc83676 authored by Paul Dyson's avatar Paul Dyson Committed by Commit Bot

Add IsVisible to TestBrowserWindowAura.

This is for testing Adaptive Screen Brightness code.

Also changes the Adaptive Screen Brightness code to
use this implementation of IsVisible.

Bug: 820883
Change-Id: Ieb46e1b6cc8e9036c4e510872ee053017426943b
Reviewed-on: https://chromium-review.googlesource.com/1004837
Commit-Queue: Paul Dyson <pdyson@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549969}
parent d2e1107a
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "services/metrics/public/cpp/ukm_source_id.h" #include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/viz/public/interfaces/compositing/video_detector_observer.mojom.h" #include "services/viz/public/interfaces/compositing/video_detector_observer.mojom.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/base/user_activity/user_activity_detector.h" #include "ui/base/user_activity/user_activity_detector.h"
namespace chromeos { namespace chromeos {
...@@ -69,8 +68,7 @@ Browser* GetFocusedOrTopmostVisibleBrowser() { ...@@ -69,8 +68,7 @@ Browser* GetFocusedOrTopmostVisibleBrowser() {
browser_iterator != browser_list->end_last_active(); browser_iterator != browser_list->end_last_active();
++browser_iterator) { ++browser_iterator) {
browser = *browser_iterator; browser = *browser_iterator;
if (browser->profile()->IsOffTheRecord() || if (browser->profile()->IsOffTheRecord() || !browser->window()->IsVisible())
!browser->window()->GetNativeWindow()->IsVisible())
continue; continue;
if (browser->window()->IsActive()) if (browser->window()->IsActive())
......
...@@ -48,6 +48,10 @@ void TestBrowserWindowAura::Hide() { ...@@ -48,6 +48,10 @@ void TestBrowserWindowAura::Hide() {
native_window_->Hide(); native_window_->Hide();
} }
bool TestBrowserWindowAura::IsVisible() const {
return native_window_->IsVisible();
}
void TestBrowserWindowAura::Activate() { void TestBrowserWindowAura::Activate() {
CHECK(native_window_->GetRootWindow()) CHECK(native_window_->GetRootWindow())
<< "A TestBrowserWindowAura must have a root window to be activated."; << "A TestBrowserWindowAura must have a root window to be activated.";
......
...@@ -19,6 +19,7 @@ class TestBrowserWindowAura : public TestBrowserWindow { ...@@ -19,6 +19,7 @@ class TestBrowserWindowAura : public TestBrowserWindow {
gfx::NativeWindow GetNativeWindow() const override; gfx::NativeWindow GetNativeWindow() const override;
void Show() override; void Show() override;
void Hide() override; void Hide() override;
bool IsVisible() const override;
void Activate() override; void Activate() override;
bool IsActive() const override; bool IsActive() const override;
gfx::Rect GetBounds() const override; gfx::Rect GetBounds() const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment