Commit 1a6a35d9 authored by Tao Bai's avatar Tao Bai Committed by Commit Bot

Observe the app state - part 1

-Add WebViewAppStateObserver.
-Notify app state change through AwContentsLifecycleNotifier.

Bug: 1042048
Change-Id: Ide14e8583e78b4597fcd061c9dabacf2cb35fe61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015407Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735197}
parent fd4fa6ad
...@@ -183,6 +183,8 @@ source_set("browser") { ...@@ -183,6 +183,8 @@ source_set("browser") {
"tracing/aw_tracing_controller.h", "tracing/aw_tracing_controller.h",
"tracing/aw_tracing_delegate.cc", "tracing/aw_tracing_delegate.cc",
"tracing/aw_tracing_delegate.h", "tracing/aw_tracing_delegate.h",
"webview_app_state_observer.cc",
"webview_app_state_observer.h",
] ]
deps = [ deps = [
......
...@@ -260,7 +260,7 @@ AwContents::AwContents(std::unique_ptr<WebContents> web_contents) ...@@ -260,7 +260,7 @@ AwContents::AwContents(std::unique_ptr<WebContents> web_contents)
InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
content::SynchronousCompositor::SetClientForWebContents( content::SynchronousCompositor::SetClientForWebContents(
web_contents_.get(), &browser_view_renderer_); web_contents_.get(), &browser_view_renderer_);
AwContentsLifecycleNotifier::OnWebViewCreated(); AwContentsLifecycleNotifier::GetInstance().OnWebViewCreated(this);
} }
void AwContents::SetJavaPeers( void AwContents::SetJavaPeers(
...@@ -362,7 +362,7 @@ AwContents::~AwContents() { ...@@ -362,7 +362,7 @@ AwContents::~AwContents() {
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
} }
browser_view_renderer_.SetCurrentCompositorFrameConsumer(nullptr); browser_view_renderer_.SetCurrentCompositorFrameConsumer(nullptr);
AwContentsLifecycleNotifier::OnWebViewDestroyed(); AwContentsLifecycleNotifier::GetInstance().OnWebViewDestroyed(this);
} }
base::android::ScopedJavaLocalRef<jobject> AwContents::GetWebContents( base::android::ScopedJavaLocalRef<jobject> AwContents::GetWebContents(
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "android_webview/browser/aw_contents_lifecycle_notifier.h" #include "android_webview/browser/aw_contents_lifecycle_notifier.h"
#include <utility>
#include "android_webview/browser_jni_headers/AwContentsLifecycleNotifier_jni.h" #include "android_webview/browser_jni_headers/AwContentsLifecycleNotifier_jni.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -13,29 +15,133 @@ using content::BrowserThread; ...@@ -13,29 +15,133 @@ using content::BrowserThread;
namespace android_webview { namespace android_webview {
// static // static
void AwContentsLifecycleNotifier::OnWebViewCreated() { AwContentsLifecycleNotifier& AwContentsLifecycleNotifier::GetInstance() {
static base::NoDestructor<AwContentsLifecycleNotifier> instance;
return *instance;
}
void AwContentsLifecycleNotifier::OnWebViewCreated(
const AwContents* aw_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (getInstance().mNumWebViews++ == 0) { has_aw_contents_ever_created_ = true;
uint64_t id = reinterpret_cast<uint64_t>(aw_contents);
bool first_created = !HasAwContentsInstance();
DCHECK(aw_contents_id_to_state_.find(id) == aw_contents_id_to_state_.end());
aw_contents_id_to_state_.insert(
std::make_pair(id, AwContentsState::kDetached));
state_count_[ToIndex(AwContentsState::kDetached)]++;
UpdateAppState();
if (first_created) {
Java_AwContentsLifecycleNotifier_onFirstWebViewCreated( Java_AwContentsLifecycleNotifier_onFirstWebViewCreated(
AttachCurrentThread()); AttachCurrentThread());
} }
} }
// static void AwContentsLifecycleNotifier::OnWebViewDestroyed(
void AwContentsLifecycleNotifier::OnWebViewDestroyed() { const AwContents* aw_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (--getInstance().mNumWebViews == 0) { uint64_t id = reinterpret_cast<uint64_t>(aw_contents);
const auto it = aw_contents_id_to_state_.find(id);
DCHECK(it != aw_contents_id_to_state_.end());
state_count_[ToIndex(it->second)]--;
DCHECK(state_count_[ToIndex(it->second)] >= 0);
aw_contents_id_to_state_.erase(it);
UpdateAppState();
if (!HasAwContentsInstance()) {
Java_AwContentsLifecycleNotifier_onLastWebViewDestroyed( Java_AwContentsLifecycleNotifier_onLastWebViewDestroyed(
AttachCurrentThread()); AttachCurrentThread());
} }
} }
// static void AwContentsLifecycleNotifier::OnWebViewAttachedToWindow(
AwContentsLifecycleNotifier& AwContentsLifecycleNotifier::getInstance() { const AwContents* aw_contents) {
static base::NoDestructor<AwContentsLifecycleNotifier> instance; DCHECK_CURRENTLY_ON(BrowserThread::UI);
return *instance; OnAwContentsStateChanged(aw_contents, AwContentsState::kBackground);
}
void AwContentsLifecycleNotifier::OnWebViewDetachedFromWindow(
const AwContents* aw_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
OnAwContentsStateChanged(aw_contents, AwContentsState::kDetached);
}
void AwContentsLifecycleNotifier::OnWebViewWindowBeVisible(
const AwContents* aw_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
OnAwContentsStateChanged(aw_contents, AwContentsState::kForeground);
}
void AwContentsLifecycleNotifier::OnWebViewWindowBeInvisible(
const AwContents* aw_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
OnAwContentsStateChanged(aw_contents, AwContentsState::kBackground);
}
void AwContentsLifecycleNotifier::AddObserver(
WebViewAppStateObserver* observer) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
observers_.AddObserver(observer);
observer->OnAppStateChanged(app_state_);
}
void AwContentsLifecycleNotifier::RemoveObserver(
WebViewAppStateObserver* observer) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
observers_.RemoveObserver(observer);
} }
AwContentsLifecycleNotifier::AwContentsLifecycleNotifier() = default; AwContentsLifecycleNotifier::AwContentsLifecycleNotifier() = default;
AwContentsLifecycleNotifier::~AwContentsLifecycleNotifier() = default;
size_t AwContentsLifecycleNotifier::ToIndex(AwContentsState state) const {
size_t index = static_cast<size_t>(state);
DCHECK(index < base::size(state_count_));
return index;
}
void AwContentsLifecycleNotifier::OnAwContentsStateChanged(
const AwContents* aw_contents,
AwContentsState state) {
uint64_t id = reinterpret_cast<uint64_t>(aw_contents);
const auto it = aw_contents_id_to_state_.find(id);
DCHECK(it != aw_contents_id_to_state_.end());
DCHECK(it->second != state);
state_count_[ToIndex(it->second)]--;
DCHECK(state_count_[ToIndex(it->second)] >= 0);
state_count_[ToIndex(state)]++;
aw_contents_id_to_state_[it->first] = state;
UpdateAppState();
}
void AwContentsLifecycleNotifier::UpdateAppState() {
WebViewAppStateObserver::State state;
if (state_count_[ToIndex(AwContentsState::kForeground)] > 0)
state = WebViewAppStateObserver::State::kForeground;
else if (state_count_[ToIndex(AwContentsState::kBackground)] > 0)
state = WebViewAppStateObserver::State::kBackground;
else if (state_count_[ToIndex(AwContentsState::kDetached)] > 0)
state = WebViewAppStateObserver::State::kUnknown;
else
state = WebViewAppStateObserver::State::kDestroyed;
if (state != app_state_) {
app_state_ = state;
for (auto& observer : observers_) {
observer.OnAppStateChanged(app_state_);
}
}
}
bool AwContentsLifecycleNotifier::HasAwContentsInstance() const {
for (size_t i = 0; i < base::size(state_count_); i++) {
if (state_count_[i] > 0)
return true;
}
return false;
}
} // namespace android_webview } // namespace android_webview
...@@ -5,26 +5,71 @@ ...@@ -5,26 +5,71 @@
#ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_LIFECYCLE_NOTIFIER_H_ #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_LIFECYCLE_NOTIFIER_H_
#define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_LIFECYCLE_NOTIFIER_H_ #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_LIFECYCLE_NOTIFIER_H_
#include <map>
#include <set>
#include "android_webview/browser/webview_app_state_observer.h"
#include "base/android/jni_android.h" #include "base/android/jni_android.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/observer_list.h"
namespace android_webview { namespace android_webview {
class AwContents;
class AwContentsLifecycleNotifier { class AwContentsLifecycleNotifier {
public: public:
static void OnWebViewCreated(); enum class AwContentsState {
static void OnWebViewDestroyed(); // AwContents isn't attached to a window.
kDetached,
// AwContents is attached to a window and window is visible.
kForeground,
// AwContents is attached to a window and window is invisible.
kBackground,
};
static AwContentsLifecycleNotifier& GetInstance();
void OnWebViewCreated(const AwContents* aw_contents);
void OnWebViewDestroyed(const AwContents* aw_contents);
void OnWebViewAttachedToWindow(const AwContents* aw_contents);
void OnWebViewDetachedFromWindow(const AwContents* aw_contents);
void OnWebViewWindowBeVisible(const AwContents* aw_contents);
void OnWebViewWindowBeInvisible(const AwContents* aw_contents);
void AddObserver(WebViewAppStateObserver* observer);
void RemoveObserver(WebViewAppStateObserver* observer);
bool has_aw_contents_ever_created() const {
return has_aw_contents_ever_created_;
}
private: private:
friend base::NoDestructor<AwContentsLifecycleNotifier>; friend base::NoDestructor<AwContentsLifecycleNotifier>;
friend class TestAwContentsLifecycleNotifier;
static AwContentsLifecycleNotifier& getInstance();
AwContentsLifecycleNotifier(); AwContentsLifecycleNotifier();
~AwContentsLifecycleNotifier() = delete; virtual ~AwContentsLifecycleNotifier();
size_t ToIndex(AwContentsState state) const;
void OnAwContentsStateChanged(const AwContents* aw_contents,
AwContentsState state);
void UpdateAppState();
bool HasAwContentsInstance() const;
// The AwContentId to AwContentState mapping.
std::map<uint64_t, AwContentsState> aw_contents_id_to_state_;
// The number of AwContents instances in each AwContentsState.
int state_count_[3]{};
bool has_aw_contents_ever_created_ = false;
int mNumWebViews = 0; base::ObserverList<WebViewAppStateObserver>::Unchecked observers_;
WebViewAppStateObserver::State app_state_ =
WebViewAppStateObserver::State::kDestroyed;
DISALLOW_COPY_AND_ASSIGN(AwContentsLifecycleNotifier); DISALLOW_COPY_AND_ASSIGN(AwContentsLifecycleNotifier);
}; };
......
// 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 "android_webview/browser/aw_contents_lifecycle_notifier.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace android_webview {
class TestWebViewAppObserver : public WebViewAppStateObserver {
public:
TestWebViewAppObserver() = default;
~TestWebViewAppObserver() override = default;
// WebViewAppStateObserver.
void OnAppStateChanged(State state) override { state_ = state; }
WebViewAppStateObserver::State state() const { return state_; }
private:
WebViewAppStateObserver::State state_;
};
class TestAwContentsLifecycleNotifier : public AwContentsLifecycleNotifier {
public:
TestAwContentsLifecycleNotifier() = default;
~TestAwContentsLifecycleNotifier() override = default;
size_t GetAwContentsStateCount(AwContentsState state) const {
return state_count_[ToIndex(state)];
}
bool HasAwContentsInstanceForTesting() const {
return this->HasAwContentsInstance();
}
};
class AwContentsLifecycleNotifierTest : public testing::Test {
public:
WebViewAppStateObserver::State GetState() const { return observer_->state(); }
size_t GetAwContentsStateCount(
AwContentsLifecycleNotifier::AwContentsState state) const {
return notifier_->GetAwContentsStateCount(state);
}
bool HasAwContentsInstance() const {
return notifier_->HasAwContentsInstanceForTesting();
}
bool HasAwContentsEverCreated() const {
return notifier_->has_aw_contents_ever_created();
}
AwContentsLifecycleNotifier* notifier() { return notifier_.get(); }
void VerifyAwContentsStateCount(size_t unknown_count,
size_t foreground_count,
size_t background_count) {
ASSERT_EQ(GetAwContentsStateCount(
AwContentsLifecycleNotifier::AwContentsState::kDetached),
unknown_count);
ASSERT_EQ(GetAwContentsStateCount(
AwContentsLifecycleNotifier::AwContentsState::kForeground),
foreground_count);
ASSERT_EQ(GetAwContentsStateCount(
AwContentsLifecycleNotifier::AwContentsState::kBackground),
background_count);
}
protected:
// testing::Test.
void SetUp() override {
observer_ = std::make_unique<TestWebViewAppObserver>();
notifier_ = std::make_unique<TestAwContentsLifecycleNotifier>();
notifier_->AddObserver(observer_.get());
}
void TearDown() override { notifier_->RemoveObserver(observer_.get()); }
private:
content::BrowserTaskEnvironment task_environment_;
std::unique_ptr<TestWebViewAppObserver> observer_;
std::unique_ptr<TestAwContentsLifecycleNotifier> notifier_;
};
TEST_F(AwContentsLifecycleNotifierTest, Created) {
const AwContents* fake_aw_contents = reinterpret_cast<const AwContents*>(1);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
ASSERT_FALSE(HasAwContentsEverCreated());
ASSERT_FALSE(HasAwContentsInstance());
notifier()->OnWebViewCreated(fake_aw_contents);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
ASSERT_TRUE(HasAwContentsInstance());
ASSERT_TRUE(HasAwContentsEverCreated());
notifier()->OnWebViewDestroyed(fake_aw_contents);
VerifyAwContentsStateCount(0, 0, 0);
ASSERT_FALSE(HasAwContentsInstance());
ASSERT_TRUE(HasAwContentsEverCreated());
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
}
TEST_F(AwContentsLifecycleNotifierTest, AttachToAndDetachFromWindow) {
const AwContents* fake_aw_contents = reinterpret_cast<const AwContents*>(1);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
ASSERT_FALSE(HasAwContentsEverCreated());
ASSERT_FALSE(HasAwContentsInstance());
notifier()->OnWebViewCreated(fake_aw_contents);
notifier()->OnWebViewAttachedToWindow(fake_aw_contents);
VerifyAwContentsStateCount(0, 0, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
ASSERT_TRUE(HasAwContentsInstance());
ASSERT_TRUE(HasAwContentsEverCreated());
notifier()->OnWebViewDetachedFromWindow(fake_aw_contents);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
ASSERT_TRUE(HasAwContentsInstance());
ASSERT_TRUE(HasAwContentsEverCreated());
notifier()->OnWebViewDestroyed(fake_aw_contents);
VerifyAwContentsStateCount(0, 0, 0);
ASSERT_FALSE(HasAwContentsInstance());
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
}
TEST_F(AwContentsLifecycleNotifierTest, WindowVisibleAndInvisible) {
const AwContents* fake_aw_contents = reinterpret_cast<const AwContents*>(1);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
ASSERT_FALSE(HasAwContentsEverCreated());
notifier()->OnWebViewCreated(fake_aw_contents);
notifier()->OnWebViewAttachedToWindow(fake_aw_contents);
notifier()->OnWebViewWindowBeVisible(fake_aw_contents);
VerifyAwContentsStateCount(0, 1u, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kForeground);
ASSERT_TRUE(HasAwContentsEverCreated());
notifier()->OnWebViewWindowBeInvisible(fake_aw_contents);
VerifyAwContentsStateCount(0, 0, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
notifier()->OnWebViewDetachedFromWindow(fake_aw_contents);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
notifier()->OnWebViewDestroyed(fake_aw_contents);
VerifyAwContentsStateCount(0, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
ASSERT_TRUE(HasAwContentsEverCreated());
}
TEST_F(AwContentsLifecycleNotifierTest, MultipleAwContents) {
const AwContents* fake_aw_contents1 = reinterpret_cast<const AwContents*>(1);
const AwContents* fake_aw_contents2 = reinterpret_cast<const AwContents*>(2);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
ASSERT_FALSE(HasAwContentsEverCreated());
notifier()->OnWebViewCreated(fake_aw_contents1);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
ASSERT_TRUE(HasAwContentsEverCreated());
notifier()->OnWebViewAttachedToWindow(fake_aw_contents1);
VerifyAwContentsStateCount(0, 0, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
notifier()->OnWebViewCreated(fake_aw_contents2);
VerifyAwContentsStateCount(1u, 0, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
notifier()->OnWebViewAttachedToWindow(fake_aw_contents2);
VerifyAwContentsStateCount(0, 0, 2u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
notifier()->OnWebViewWindowBeVisible(fake_aw_contents2);
VerifyAwContentsStateCount(0, 1u, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kForeground);
notifier()->OnWebViewWindowBeVisible(fake_aw_contents1);
VerifyAwContentsStateCount(0, 2u, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kForeground);
notifier()->OnWebViewDestroyed(fake_aw_contents2);
VerifyAwContentsStateCount(0, 1u, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kForeground);
notifier()->OnWebViewWindowBeInvisible(fake_aw_contents1);
VerifyAwContentsStateCount(0, 0, 1u);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kBackground);
notifier()->OnWebViewDetachedFromWindow(fake_aw_contents1);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
notifier()->OnWebViewDestroyed(fake_aw_contents1);
VerifyAwContentsStateCount(0, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kDestroyed);
notifier()->OnWebViewCreated(fake_aw_contents1);
VerifyAwContentsStateCount(1u, 0, 0);
ASSERT_EQ(GetState(), WebViewAppStateObserver::State::kUnknown);
ASSERT_TRUE(HasAwContentsEverCreated());
}
} // namespace android_webview
// 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 "android_webview/browser/webview_app_state_observer.h"
namespace android_webview {
WebViewAppStateObserver::WebViewAppStateObserver() = default;
WebViewAppStateObserver::~WebViewAppStateObserver() = default;
} // namespace android_webview
// 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 ANDROID_WEBVIEW_BROWSER_WEBVIEW_APP_STATE_OBSERVER_H_
#define ANDROID_WEBVIEW_BROWSER_WEBVIEW_APP_STATE_OBSERVER_H_
namespace android_webview {
// The interface for being notified of app state change, the implementation
// shall be added to observer list through AwContentsLifecycleNotifier.
class WebViewAppStateObserver {
public:
enum class State {
// All WebViews are in unknown state.
kUnknown,
// At least one WebView is foreground.
kForeground,
// No WebView is foreground and at least one WebView is background.
kBackground,
// All WebViews are destroyed or no WebView has been created.
// Observers shall use
// AwContentsLifecycleNotifier::has_aw_contents_ever_created() to find if A
// WebView has ever been created.
kDestroyed,
};
WebViewAppStateObserver();
virtual ~WebViewAppStateObserver();
// Invoked when app state is changed or right after this observer is added
// into observer list.
virtual void OnAppStateChanged(State state) = 0;
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_WEBVIEW_APP_STATE_OBSERVER_H_
...@@ -23,9 +23,7 @@ if (public_android_sdk) { ...@@ -23,9 +23,7 @@ if (public_android_sdk) {
group("webview_cts_tests") { group("webview_cts_tests") {
_py_files = _py_files =
read_file("//android_webview/tools/run_cts.pydeps", "list lines") read_file("//android_webview/tools/run_cts.pydeps", "list lines")
deps = [ deps = [ "//android_webview:system_webview_apk" ]
"//android_webview:system_webview_apk",
]
data_deps = [ data_deps = [
"//build/android:logdog_wrapper_py", "//build/android:logdog_wrapper_py",
...@@ -144,9 +142,7 @@ android_assets("webview_instrumentation_apk_assets") { ...@@ -144,9 +142,7 @@ android_assets("webview_instrumentation_apk_assets") {
shared_library("libstandalonelibwebviewchromium") { shared_library("libstandalonelibwebviewchromium") {
testonly = true testonly = true
sources = [ sources = [ "shell/src/draw_gl/draw_fn.cc" ]
"shell/src/draw_gl/draw_fn.cc",
]
ldflags = [ "-Wl,-shared,-Bsymbolic" ] ldflags = [ "-Wl,-shared,-Bsymbolic" ]
deps = [ deps = [
":webview_instrumentation_test_native_jni_impl", ":webview_instrumentation_test_native_jni_impl",
...@@ -312,12 +308,9 @@ instrumentation_test_apk("webview_instrumentation_test_apk") { ...@@ -312,12 +308,9 @@ instrumentation_test_apk("webview_instrumentation_test_apk") {
"../javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java", "../javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java",
"../javatests/src/org/chromium/android_webview/test/util/VideoTestWebServer.java", "../javatests/src/org/chromium/android_webview/test/util/VideoTestWebServer.java",
] ]
data = [ data = [ "data/" ]
"data/", data_deps =
] [ "//testing/buildbot/filters:webview_instrumentation_test_apk_filters" ]
data_deps = [
"//testing/buildbot/filters:webview_instrumentation_test_apk_filters",
]
if (enable_chrome_android_internal) { if (enable_chrome_android_internal) {
data_deps += data_deps +=
...@@ -339,9 +332,7 @@ instrumentation_test_apk("webview_instrumentation_test_apk") { ...@@ -339,9 +332,7 @@ instrumentation_test_apk("webview_instrumentation_test_apk") {
android_library("webview_instrumentation_test_utils_java") { android_library("webview_instrumentation_test_utils_java") {
testonly = true testonly = true
sources = [ sources = [ "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java" ]
"shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java",
]
deps = [ deps = [
"//base:base_java", "//base:base_java",
"//base:jni_java", "//base:jni_java",
...@@ -351,15 +342,11 @@ android_library("webview_instrumentation_test_utils_java") { ...@@ -351,15 +342,11 @@ android_library("webview_instrumentation_test_utils_java") {
generate_jni("webview_instrumentation_test_native_jni") { generate_jni("webview_instrumentation_test_native_jni") {
testonly = true testonly = true
sources = [ sources = [ "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java" ]
"shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java",
]
} }
source_set("webview_instrumentation_test_native_jni_impl") { source_set("webview_instrumentation_test_native_jni_impl") {
sources = [ sources = [ "shell/memory_metrics_logger_utils.cc" ]
"shell/memory_metrics_logger_utils.cc",
]
deps = [ deps = [
":webview_instrumentation_test_native_jni", ":webview_instrumentation_test_native_jni",
...@@ -398,6 +385,7 @@ test("android_webview_unittests") { ...@@ -398,6 +385,7 @@ test("android_webview_unittests") {
"../browser/aw_browser_context_unittest.cc", "../browser/aw_browser_context_unittest.cc",
"../browser/aw_content_browser_client_unittest.cc", "../browser/aw_content_browser_client_unittest.cc",
"../browser/aw_contents_client_bridge_unittest.cc", "../browser/aw_contents_client_bridge_unittest.cc",
"../browser/aw_contents_lifecycle_notifier_unittest.cc",
"../browser/aw_form_database_service_unittest.cc", "../browser/aw_form_database_service_unittest.cc",
"../browser/aw_media_url_interceptor_unittest.cc", "../browser/aw_media_url_interceptor_unittest.cc",
"../browser/aw_pac_processor_unittest.cc", "../browser/aw_pac_processor_unittest.cc",
...@@ -427,9 +415,7 @@ test("android_webview_unittests") { ...@@ -427,9 +415,7 @@ test("android_webview_unittests") {
} }
android_assets("android_webview_unittests_assets") { android_assets("android_webview_unittests_assets") {
sources = [ sources = [ "unittest/assets/asset_file.ogg" ]
"unittest/assets/asset_file.ogg",
]
} }
android_library("android_webview_unittests_java") { android_library("android_webview_unittests_java") {
......
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