forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ambient: Enable ambient mode by default
Bug: b/171071314 Test: Added new test helper and fixes tests. Change-Id: I22c9fe099025a51c999f2d8fbfa12d983f0aa5d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505670 Commit-Queue: Tao Wu <wutao@chromium.org> Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org> Cr-Commit-Position: refs/heads/master@{#825527}
- Loading branch information
wutao
authored and
Commit Bot
committed
Nov 9, 2020
1 parent
87903f0
commit 92a8f5c
Showing
17 changed files
with
110 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/ambient/test/ambient_ash_test_helper.h" | ||
|
||
#include "ash/ambient/test/test_ambient_client.h" | ||
#include "ash/public/cpp/test/test_image_downloader.h" | ||
|
||
namespace ash { | ||
|
||
AmbientAshTestHelper::AmbientAshTestHelper() { | ||
image_downloader_ = std::make_unique<TestImageDownloader>(); | ||
ambient_client_ = std::make_unique<TestAmbientClient>(&wake_lock_provider_); | ||
} | ||
|
||
AmbientAshTestHelper::~AmbientAshTestHelper() = default; | ||
|
||
void AmbientAshTestHelper::IssueAccessToken(const std::string& token, | ||
bool with_error) { | ||
ambient_client_->IssueAccessToken(token, with_error); | ||
} | ||
|
||
bool AmbientAshTestHelper::IsAccessTokenRequestPending() const { | ||
return ambient_client_->IsAccessTokenRequestPending(); | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_AMBIENT_TEST_AMBIENT_ASH_TEST_HELPER_H_ | ||
#define ASH_AMBIENT_TEST_AMBIENT_ASH_TEST_HELPER_H_ | ||
|
||
#include <memory> | ||
|
||
#include "services/device/public/cpp/test/test_wake_lock_provider.h" | ||
|
||
namespace ash { | ||
|
||
class TestImageDownloader; | ||
class TestAmbientClient; | ||
|
||
// The helper class to test the Ambient Mode in Ash. | ||
class AmbientAshTestHelper { | ||
public: | ||
AmbientAshTestHelper(); | ||
~AmbientAshTestHelper(); | ||
|
||
// Simulate to issue an |access_token|. | ||
// If |with_error| is true, will return an empty access token. | ||
void IssueAccessToken(const std::string& access_token, bool with_error); | ||
|
||
bool IsAccessTokenRequestPending() const; | ||
|
||
device::TestWakeLockProvider* wake_lock_provider() { | ||
return &wake_lock_provider_; | ||
} | ||
|
||
private: | ||
std::unique_ptr<TestImageDownloader> image_downloader_; | ||
device::TestWakeLockProvider wake_lock_provider_; | ||
std::unique_ptr<TestAmbientClient> ambient_client_; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_AMBIENT_TEST_AMBIENT_ASH_TEST_HELPER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.