Commit 5647dd6d authored by James Cook's avatar James Cook Committed by Commit Bot

lacros: Rename ScreenManagerCrosapi to ScreenManagerAsh

Also move it into namespace crosapi.

This is more consistent with our current naming conventions.

Bug: none
Test: compiles
Change-Id: I1859bb7f3afde20aca7cf9dd516d06fd62118883
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362732Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799346}
parent c17feb22
...@@ -946,8 +946,8 @@ source_set("chromeos") { ...@@ -946,8 +946,8 @@ source_set("chromeos") {
"crosapi/browser_util.h", "crosapi/browser_util.h",
"crosapi/message_center_ash.cc", "crosapi/message_center_ash.cc",
"crosapi/message_center_ash.h", "crosapi/message_center_ash.h",
"crosapi/screen_manager_crosapi.cc", "crosapi/screen_manager_ash.cc",
"crosapi/screen_manager_crosapi.h", "crosapi/screen_manager_ash.h",
"crosapi/select_file_ash.cc", "crosapi/select_file_ash.cc",
"crosapi/select_file_ash.h", "crosapi/select_file_ash.h",
"crostini/ansible/ansible_management_service.cc", "crostini/ansible/ansible_management_service.cc",
......
...@@ -6,7 +6,7 @@ specific_include_rules = { ...@@ -6,7 +6,7 @@ specific_include_rules = {
"+chrome/browser/chromeos/crosapi", "+chrome/browser/chromeos/crosapi",
"+ui/message_center/message_center.h", "+ui/message_center/message_center.h",
], ],
"screen_manager_crosapi\.cc": [ "screen_manager_ash\.cc": [
# For window parenting. # For window parenting.
"+ash/shell.h", "+ash/shell.h",
], ],
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/chromeos/crosapi/attestation_ash.h" #include "chrome/browser/chromeos/crosapi/attestation_ash.h"
#include "chrome/browser/chromeos/crosapi/message_center_ash.h" #include "chrome/browser/chromeos/crosapi/message_center_ash.h"
#include "chrome/browser/chromeos/crosapi/screen_manager_crosapi.h" #include "chrome/browser/chromeos/crosapi/screen_manager_ash.h"
#include "chrome/browser/chromeos/crosapi/select_file_ash.h" #include "chrome/browser/chromeos/crosapi/select_file_ash.h"
#include "chromeos/crosapi/mojom/attestation.mojom.h" #include "chromeos/crosapi/mojom/attestation.mojom.h"
#include "chromeos/crosapi/mojom/message_center.mojom.h" #include "chromeos/crosapi/mojom/message_center.mojom.h"
...@@ -23,7 +23,7 @@ namespace crosapi { ...@@ -23,7 +23,7 @@ namespace crosapi {
AshChromeServiceImpl::AshChromeServiceImpl( AshChromeServiceImpl::AshChromeServiceImpl(
mojo::PendingReceiver<mojom::AshChromeService> pending_receiver) mojo::PendingReceiver<mojom::AshChromeService> pending_receiver)
: receiver_(this, std::move(pending_receiver)), : receiver_(this, std::move(pending_receiver)),
screen_manager_crosapi_(std::make_unique<ScreenManagerCrosapi>()) { screen_manager_ash_(std::make_unique<ScreenManagerAsh>()) {
// TODO(hidehiko): Remove non-critical log from here. // TODO(hidehiko): Remove non-critical log from here.
// Currently this is the signal that the connection is established. // Currently this is the signal that the connection is established.
LOG(WARNING) << "AshChromeService connected."; LOG(WARNING) << "AshChromeService connected.";
...@@ -44,12 +44,12 @@ void AshChromeServiceImpl::BindMessageCenter( ...@@ -44,12 +44,12 @@ void AshChromeServiceImpl::BindMessageCenter(
void AshChromeServiceImpl::BindSelectFile( void AshChromeServiceImpl::BindSelectFile(
mojo::PendingReceiver<mojom::SelectFile> receiver) { mojo::PendingReceiver<mojom::SelectFile> receiver) {
select_file_crosapi_ = std::make_unique<SelectFileAsh>(std::move(receiver)); select_file_ash_ = std::make_unique<SelectFileAsh>(std::move(receiver));
} }
void AshChromeServiceImpl::BindScreenManager( void AshChromeServiceImpl::BindScreenManager(
mojo::PendingReceiver<mojom::ScreenManager> receiver) { mojo::PendingReceiver<mojom::ScreenManager> receiver) {
screen_manager_crosapi_->BindReceiver(std::move(receiver)); screen_manager_ash_->BindReceiver(std::move(receiver));
} }
} // namespace crosapi } // namespace crosapi
...@@ -11,12 +11,11 @@ ...@@ -11,12 +11,11 @@
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver.h"
class ScreenManagerCrosapi;
namespace crosapi { namespace crosapi {
class AttestationAsh; class AttestationAsh;
class MessageCenterAsh; class MessageCenterAsh;
class ScreenManagerAsh;
class SelectFileAsh; class SelectFileAsh;
// Implementation of AshChromeService. It provides a set of APIs that // Implementation of AshChromeService. It provides a set of APIs that
...@@ -42,8 +41,8 @@ class AshChromeServiceImpl : public mojom::AshChromeService { ...@@ -42,8 +41,8 @@ class AshChromeServiceImpl : public mojom::AshChromeService {
std::unique_ptr<AttestationAsh> attestation_ash_; std::unique_ptr<AttestationAsh> attestation_ash_;
std::unique_ptr<MessageCenterAsh> message_center_ash_; std::unique_ptr<MessageCenterAsh> message_center_ash_;
std::unique_ptr<ScreenManagerCrosapi> screen_manager_crosapi_; std::unique_ptr<ScreenManagerAsh> screen_manager_ash_;
std::unique_ptr<SelectFileAsh> select_file_crosapi_; std::unique_ptr<SelectFileAsh> select_file_ash_;
}; };
} // namespace crosapi } // namespace crosapi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/chromeos/crosapi/screen_manager_crosapi.h" #include "chrome/browser/chromeos/crosapi/screen_manager_ash.h"
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -16,32 +16,33 @@ ...@@ -16,32 +16,33 @@
#include "chromeos/crosapi/cpp/bitmap.h" #include "chromeos/crosapi/cpp/bitmap.h"
#include "ui/snapshot/snapshot.h" #include "ui/snapshot/snapshot.h"
ScreenManagerCrosapi::ScreenManagerCrosapi() = default; namespace crosapi {
ScreenManagerCrosapi::~ScreenManagerCrosapi() { ScreenManagerAsh::ScreenManagerAsh() = default;
ScreenManagerAsh::~ScreenManagerAsh() {
for (auto pair : window_to_id_) { for (auto pair : window_to_id_) {
pair.first->RemoveObserver(this); pair.first->RemoveObserver(this);
} }
} }
void ScreenManagerCrosapi::BindReceiver( void ScreenManagerAsh::BindReceiver(
mojo::PendingReceiver<crosapi::mojom::ScreenManager> receiver) { mojo::PendingReceiver<mojom::ScreenManager> receiver) {
receivers_.Add(this, std::move(receiver)); receivers_.Add(this, std::move(receiver));
} }
void ScreenManagerCrosapi::TakeScreenSnapshot( void ScreenManagerAsh::TakeScreenSnapshot(TakeScreenSnapshotCallback callback) {
TakeScreenSnapshotCallback callback) {
// TODO(https://crbug.com/1094460): Handle display selection and multiple // TODO(https://crbug.com/1094460): Handle display selection and multiple
// displays. // displays.
aura::Window* primary_window = ash::Shell::GetPrimaryRootWindow(); aura::Window* primary_window = ash::Shell::GetPrimaryRootWindow();
ui::GrabWindowSnapshotAsync( ui::GrabWindowSnapshotAsync(
primary_window, primary_window->bounds(), primary_window, primary_window->bounds(),
base::BindOnce(&ScreenManagerCrosapi::DidTakeSnapshot, base::BindOnce(&ScreenManagerAsh::DidTakeSnapshot,
weak_factory_.GetWeakPtr(), std::move(callback))); weak_factory_.GetWeakPtr(), std::move(callback)));
} }
void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) { void ScreenManagerAsh::ListWindows(ListWindowsCallback callback) {
// TODO(https://crbug.com/1094460): Handle window selection and multiple // TODO(https://crbug.com/1094460): Handle window selection and multiple
// virtual desktops. // virtual desktops.
aura::Window* container = aura::Window* container =
...@@ -49,7 +50,7 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) { ...@@ -49,7 +50,7 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) {
ash::kShellWindowId_DefaultContainerDeprecated); ash::kShellWindowId_DefaultContainerDeprecated);
// We need to create a vector that contains window_id and title. // We need to create a vector that contains window_id and title.
std::vector<crosapi::mojom::WindowDetailsPtr> windows; std::vector<mojom::WindowDetailsPtr> windows;
// The |container| has all the top-level windows in reverse order, e.g. the // The |container| has all the top-level windows in reverse order, e.g. the
// most top-level window is at the end. So iterate children reversely to make // most top-level window is at the end. So iterate children reversely to make
...@@ -64,8 +65,7 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) { ...@@ -64,8 +65,7 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) {
if (!window->IsVisible() || !window->CanFocus()) if (!window->IsVisible() || !window->CanFocus())
continue; continue;
crosapi::mojom::WindowDetailsPtr details = mojom::WindowDetailsPtr details = mojom::WindowDetails::New();
crosapi::mojom::WindowDetails::New();
// We are already tracking the window. // We are already tracking the window.
auto existing_window_it = window_to_id_.find(window); auto existing_window_it = window_to_id_.find(window);
...@@ -88,12 +88,11 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) { ...@@ -88,12 +88,11 @@ void ScreenManagerCrosapi::ListWindows(ListWindowsCallback callback) {
std::move(callback).Run(std::move(windows)); std::move(callback).Run(std::move(windows));
} }
void ScreenManagerCrosapi::TakeWindowSnapshot( void ScreenManagerAsh::TakeWindowSnapshot(uint64_t id,
uint64_t id, TakeWindowSnapshotCallback callback) {
TakeWindowSnapshotCallback callback) {
auto it = id_to_window_.find(id); auto it = id_to_window_.find(id);
if (it == id_to_window_.end()) { if (it == id_to_window_.end()) {
std::move(callback).Run(/*success=*/false, crosapi::Bitmap()); std::move(callback).Run(/*success=*/false, Bitmap());
return; return;
} }
...@@ -105,11 +104,11 @@ void ScreenManagerCrosapi::TakeWindowSnapshot( ...@@ -105,11 +104,11 @@ void ScreenManagerCrosapi::TakeWindowSnapshot(
bounds.set_y(0); bounds.set_y(0);
ui::GrabWindowSnapshotAsync( ui::GrabWindowSnapshotAsync(
window, bounds, window, bounds,
base::BindOnce(&ScreenManagerCrosapi::DidTakeSnapshot, base::BindOnce(&ScreenManagerAsh::DidTakeSnapshot,
weak_factory_.GetWeakPtr(), std::move(snapshot_callback))); weak_factory_.GetWeakPtr(), std::move(snapshot_callback)));
} }
void ScreenManagerCrosapi::OnWindowDestroying(aura::Window* window) { void ScreenManagerAsh::OnWindowDestroying(aura::Window* window) {
auto it = window_to_id_.find(window); auto it = window_to_id_.find(window);
if (it == window_to_id_.end()) if (it == window_to_id_.end())
return; return;
...@@ -118,8 +117,8 @@ void ScreenManagerCrosapi::OnWindowDestroying(aura::Window* window) { ...@@ -118,8 +117,8 @@ void ScreenManagerCrosapi::OnWindowDestroying(aura::Window* window) {
id_to_window_.erase(id); id_to_window_.erase(id);
} }
void ScreenManagerCrosapi::DidTakeSnapshot(SnapshotCallback callback, void ScreenManagerAsh::DidTakeSnapshot(SnapshotCallback callback,
gfx::Image image) { gfx::Image image) {
SkBitmap bitmap = image.AsBitmap(); SkBitmap bitmap = image.AsBitmap();
// This code currently relies on the assumption that the bitmap is unpadded, // This code currently relies on the assumption that the bitmap is unpadded,
...@@ -132,9 +131,11 @@ void ScreenManagerCrosapi::DidTakeSnapshot(SnapshotCallback callback, ...@@ -132,9 +131,11 @@ void ScreenManagerCrosapi::DidTakeSnapshot(SnapshotCallback callback,
uint8_t* base = static_cast<uint8_t*>(bitmap.getPixels()); uint8_t* base = static_cast<uint8_t*>(bitmap.getPixels());
std::vector<uint8_t> bytes(base, base + bitmap.computeByteSize()); std::vector<uint8_t> bytes(base, base + bitmap.computeByteSize());
crosapi::Bitmap snapshot; Bitmap snapshot;
snapshot.width = bitmap.width(); snapshot.width = bitmap.width();
snapshot.height = bitmap.height(); snapshot.height = bitmap.height();
snapshot.pixels.swap(bytes); snapshot.pixels.swap(bytes);
std::move(callback).Run(std::move(snapshot)); std::move(callback).Run(std::move(snapshot));
} }
} // namespace crosapi
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_CROSAPI_H_ #ifndef CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_ASH_H_
#define CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_CROSAPI_H_ #define CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_ASH_H_
#include <stdint.h> #include <stdint.h>
...@@ -17,21 +17,19 @@ ...@@ -17,21 +17,19 @@
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
namespace crosapi { namespace crosapi {
struct Bitmap; struct Bitmap;
} // namespace crosapi
// This class is the ash-chrome implementation of the ScreenManager interface. // This class is the ash-chrome implementation of the ScreenManager interface.
// This class must only be used from the main thread. // This class must only be used from the main thread.
class ScreenManagerCrosapi : public crosapi::mojom::ScreenManager, class ScreenManagerAsh : public mojom::ScreenManager, aura::WindowObserver {
aura::WindowObserver {
public: public:
ScreenManagerCrosapi(); ScreenManagerAsh();
ScreenManagerCrosapi(const ScreenManagerCrosapi&) = delete; ScreenManagerAsh(const ScreenManagerAsh&) = delete;
ScreenManagerCrosapi& operator=(const ScreenManagerCrosapi&) = delete; ScreenManagerAsh& operator=(const ScreenManagerAsh&) = delete;
~ScreenManagerCrosapi() override; ~ScreenManagerAsh() override;
void BindReceiver( void BindReceiver(mojo::PendingReceiver<mojom::ScreenManager> receiver);
mojo::PendingReceiver<crosapi::mojom::ScreenManager> receiver);
// crosapi::mojom::ScreenManager: // crosapi::mojom::ScreenManager:
void TakeScreenSnapshot(TakeScreenSnapshotCallback callback) override; void TakeScreenSnapshot(TakeScreenSnapshotCallback callback) override;
...@@ -46,7 +44,7 @@ class ScreenManagerCrosapi : public crosapi::mojom::ScreenManager, ...@@ -46,7 +44,7 @@ class ScreenManagerCrosapi : public crosapi::mojom::ScreenManager,
void OnWindowDestroying(aura::Window* window) final; void OnWindowDestroying(aura::Window* window) final;
private: private:
using SnapshotCallback = base::OnceCallback<void(const crosapi::Bitmap&)>; using SnapshotCallback = base::OnceCallback<void(const Bitmap&)>;
void DidTakeSnapshot(SnapshotCallback callback, gfx::Image image); void DidTakeSnapshot(SnapshotCallback callback, gfx::Image image);
// This class generates unique, non-reused IDs for windows on demand. The IDs // This class generates unique, non-reused IDs for windows on demand. The IDs
...@@ -63,9 +61,11 @@ class ScreenManagerCrosapi : public crosapi::mojom::ScreenManager, ...@@ -63,9 +61,11 @@ class ScreenManagerCrosapi : public crosapi::mojom::ScreenManager,
// This class supports any number of connections. This allows the client to // This class supports any number of connections. This allows the client to
// have multiple, potentially thread-affine, remotes. This is needed by // have multiple, potentially thread-affine, remotes. This is needed by
// WebRTC. // WebRTC.
mojo::ReceiverSet<crosapi::mojom::ScreenManager> receivers_; mojo::ReceiverSet<mojom::ScreenManager> receivers_;
base::WeakPtrFactory<ScreenManagerCrosapi> weak_factory_{this}; base::WeakPtrFactory<ScreenManagerAsh> weak_factory_{this};
}; };
#endif // CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_CROSAPI_H_ } // namespace crosapi
#endif // CHROME_BROWSER_CHROMEOS_CROSAPI_SCREEN_MANAGER_ASH_H_
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "chrome/browser/chromeos/crosapi/screen_manager_crosapi.h" #include "chrome/browser/chromeos/crosapi/screen_manager_ash.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -18,32 +18,31 @@ ...@@ -18,32 +18,31 @@
#include "mojo/public/cpp/bindings/sync_call_restrictions.h" #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace crosapi {
namespace { namespace {
// This class tests that the ash-chrome implementation of the screen manager // This class tests that the ash-chrome implementation of the screen manager
// crosapi works properly. // crosapi works properly.
class ScreenManagerCrosapiBrowserTest : public InProcessBrowserTest { class ScreenManagerAshBrowserTest : public InProcessBrowserTest {
protected: protected:
using SMRemote = mojo::Remote<crosapi::mojom::ScreenManager>; using SMRemote = mojo::Remote<mojom::ScreenManager>;
using SMPendingRemote = mojo::PendingRemote<crosapi::mojom::ScreenManager>; using SMPendingRemote = mojo::PendingRemote<mojom::ScreenManager>;
using SMPendingReceiver = using SMPendingReceiver = mojo::PendingReceiver<mojom::ScreenManager>;
mojo::PendingReceiver<crosapi::mojom::ScreenManager>;
ScreenManagerCrosapiBrowserTest() = default; ScreenManagerAshBrowserTest() = default;
ScreenManagerCrosapiBrowserTest(const ScreenManagerCrosapiBrowserTest&) = ScreenManagerAshBrowserTest(const ScreenManagerAshBrowserTest&) = delete;
ScreenManagerAshBrowserTest& operator=(const ScreenManagerAshBrowserTest&) =
delete; delete;
ScreenManagerCrosapiBrowserTest& operator=(
const ScreenManagerCrosapiBrowserTest&) = delete;
~ScreenManagerCrosapiBrowserTest() override { ~ScreenManagerAshBrowserTest() override {
background_sequence_->DeleteSoon(FROM_HERE, background_sequence_->DeleteSoon(FROM_HERE,
std::move(screen_manager_remote_)); std::move(screen_manager_remote_));
} }
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
// The implementation of screen manager is affine to this sequence. // The implementation of screen manager is affine to this sequence.
screen_manager_ = std::make_unique<ScreenManagerCrosapi>(); screen_manager_ = std::make_unique<ScreenManagerAsh>();
SMPendingRemote pending_remote; SMPendingRemote pending_remote;
SMPendingReceiver pending_receiver = SMPendingReceiver pending_receiver =
...@@ -70,7 +69,7 @@ class ScreenManagerCrosapiBrowserTest : public InProcessBrowserTest { ...@@ -70,7 +69,7 @@ class ScreenManagerCrosapiBrowserTest : public InProcessBrowserTest {
} }
// Affine to main sequence. // Affine to main sequence.
std::unique_ptr<ScreenManagerCrosapi> screen_manager_; std::unique_ptr<ScreenManagerAsh> screen_manager_;
// A sequence that is allowed to block. // A sequence that is allowed to block.
scoped_refptr<base::SequencedTaskRunner> background_sequence_; scoped_refptr<base::SequencedTaskRunner> background_sequence_;
...@@ -80,14 +79,14 @@ class ScreenManagerCrosapiBrowserTest : public InProcessBrowserTest { ...@@ -80,14 +79,14 @@ class ScreenManagerCrosapiBrowserTest : public InProcessBrowserTest {
}; };
// Tests that taking a screen snapshot works. // Tests that taking a screen snapshot works.
IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeScreenSnapshot) { IN_PROC_BROWSER_TEST_F(ScreenManagerAshBrowserTest, TakeScreenSnapshot) {
base::RunLoop run_loop; base::RunLoop run_loop;
crosapi::Bitmap snapshot; Bitmap snapshot;
// Take a snapshot on a background sequence. The call is blocking, so when it // Take a snapshot on a background sequence. The call is blocking, so when it
// finishes, we can also unblock the main thread. // finishes, we can also unblock the main thread.
auto take_snapshot_background = base::BindOnce( auto take_snapshot_background = base::BindOnce(
[](SMRemote* remote, crosapi::Bitmap* snapshot) { [](SMRemote* remote, Bitmap* snapshot) {
mojo::ScopedAllowSyncCallForTesting allow_sync; mojo::ScopedAllowSyncCallForTesting allow_sync;
(*remote)->TakeScreenSnapshot(snapshot); (*remote)->TakeScreenSnapshot(snapshot);
}, },
...@@ -103,17 +102,17 @@ IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeScreenSnapshot) { ...@@ -103,17 +102,17 @@ IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeScreenSnapshot) {
EXPECT_EQ(int{snapshot.height}, primary_window->bounds().height()); EXPECT_EQ(int{snapshot.height}, primary_window->bounds().height());
} }
IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeWindowSnapshot) { IN_PROC_BROWSER_TEST_F(ScreenManagerAshBrowserTest, TakeWindowSnapshot) {
base::RunLoop run_loop; base::RunLoop run_loop;
bool success; bool success;
crosapi::Bitmap snapshot; Bitmap snapshot;
// Take a snapshot on a background sequence. The call is blocking, so when it // Take a snapshot on a background sequence. The call is blocking, so when it
// finishes, we can also unblock the main thread. // finishes, we can also unblock the main thread.
auto take_snapshot_background = base::BindOnce( auto take_snapshot_background = base::BindOnce(
[](SMRemote* remote, bool* success, crosapi::Bitmap* snapshot) { [](SMRemote* remote, bool* success, Bitmap* snapshot) {
mojo::ScopedAllowSyncCallForTesting allow_sync; mojo::ScopedAllowSyncCallForTesting allow_sync;
std::vector<crosapi::mojom::WindowDetailsPtr> windows; std::vector<mojom::WindowDetailsPtr> windows;
(*remote)->ListWindows(&windows); (*remote)->ListWindows(&windows);
// There should be exactly 1 window. // There should be exactly 1 window.
...@@ -136,3 +135,4 @@ IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeWindowSnapshot) { ...@@ -136,3 +135,4 @@ IN_PROC_BROWSER_TEST_F(ScreenManagerCrosapiBrowserTest, TakeWindowSnapshot) {
} }
} // namespace } // namespace
} // namespace crosapi
...@@ -2162,9 +2162,8 @@ if (!is_android) { ...@@ -2162,9 +2162,8 @@ if (!is_android) {
# Browser tests for functionality that is only intended to be present in # Browser tests for functionality that is only intended to be present in
# ash-chrome, not lacros-chrome. # ash-chrome, not lacros-chrome.
if (is_chromeos && !chromeos_is_browser_only) { if (is_chromeos && !chromeos_is_browser_only) {
sources += [ sources +=
"../browser/chromeos/crosapi/screen_manager_crosapi_browsertest.cc", [ "../browser/chromeos/crosapi/screen_manager_ash_browsertest.cc" ]
]
} }
if (is_chromeos) { if (is_chromeos) {
......
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