Commit 0a33937c authored by David's avatar David Committed by Chromium LUCI CQ

CrOS Media App: Flip image annotation flag to be default true for M89.

This change makes image annotation default true. Image annotation uses
the ink library which is now built with the CrOS Media App see
http://cl/347557653 & crrev/c/2542926.

Since this updated version of ink is now in the CrOS binary, we can
flip this flag to default true!

Also adds an integration test to ensure ink loads in our guest frame.
The integration test is only built & run in `linux-chromeos-chrome`
since it tries to load ink which will fail in `linux-chromeos-rel` as
that doesn't pull in our CIPD package.

Bug: b/170161460, 1150244, 1139469
Change-Id: I1460ed2e7fb682ed54a4ee3b210f425b233a6150
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594615
Commit-Queue: David Lei <dlei@google.com>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Reviewed-by: default avatarPatti <patricialor@chromium.org>
Reviewed-by: default avatarDavid Lei <dlei@google.com>
Auto-Submit: David Lei <dlei@google.com>
Cr-Commit-Position: refs/heads/master@{#837953}
parent 6a0e4207
......@@ -21,6 +21,7 @@
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chromeos/components/media_app_ui/buildflags.h"
#include "chromeos/components/media_app_ui/test/media_app_ui_browsertest.h"
#include "chromeos/components/media_app_ui/url_constants.h"
#include "chromeos/constants/chromeos_features.h"
......@@ -213,6 +214,53 @@ IN_PROC_BROWSER_TEST_P(MediaAppIntegrationTest, LoadsPdf) {
EXPECT_EQ(true, MediaAppUiBrowserTest::EvalJsInAppFrame(app, loadPdf));
}
// This test tries to load files bundled in our CIPD package. The CIPD package
// is included in the `linux-chromeos-chrome` trybot but not in
// `linux-chromeos-rel` trybot. Only include this test when our CIPD package is
// present.
#if BUILDFLAG(ENABLE_CROS_MEDIA_APP)
IN_PROC_BROWSER_TEST_P(MediaAppIntegrationTest, LoadsInkForImageAnnotation) {
WaitForTestSystemAppInstall();
auto params = LaunchParamsForApp(web_app::SystemAppType::MEDIA);
params.launch_files = {TestFile(kFileJpeg640x480)};
content::WebContents* app = LaunchApp(std::move(params));
PrepareAppForTest(app);
// Ensure test image loaded.
EXPECT_EQ("640x480", WaitForImageAlt(app, kFileJpeg640x480));
// TODO(b/175766054): Decipher if we can one line getting the annotate button
// in `waitForNode`.
constexpr char clickAnnotate[] = R"(
(async () => {
const appBar = await waitForNode('backlight-app-bar', ['backlight-app']);
const annotateButton = appBar.shadowRoot.querySelector('[label="Annotate"]');
annotateButton.click();
return true;
})();
)";
EXPECT_EQ(true, MediaAppUiBrowserTest::EvalJsInAppFrame(app, clickAnnotate));
// Checks ink is loaded for images by ensuring the ink engine canvas has a non
// zero width and height attributes (checking <canvas.width/height is
// insufficient since it has a default width of 300 and height of 150).
// Note: The loading of ink engine elements can be async.
constexpr char checkInkLoaded[] = R"(
(async () => {
const inkEngineCanvas = await waitForNode('canvas#ink-engine[width]', ['backlight-image-handler']);
return !!inkEngineCanvas &&
!!inkEngineCanvas.getAttribute('height') &&
inkEngineCanvas.getAttribute('height') !== '0' &&
!!inkEngineCanvas.getAttribute('width') &&
inkEngineCanvas.getAttribute('width') !== '0';
})();
)";
// TODO(b/175840855): Consider checking `inkEngineCanvas` size, it is
// currently different to image size.
EXPECT_EQ(true, MediaAppUiBrowserTest::EvalJsInAppFrame(app, checkInkLoaded));
}
#endif // BUILDFLAG(ENABLE_CROS_MEDIA_APP)
// Test that the MediaApp can load RAW files passed on launch params.
IN_PROC_BROWSER_TEST_P(MediaAppIntegrationTest, HandleRawFiles) {
WaitForTestSystemAppInstall();
......
......@@ -2913,6 +2913,7 @@ if (!is_android) {
]
deps += [
"//chromeos/components/media_app_ui:buildflags",
"//chromeos/ui/frame:test_support",
"//components/crash/content/browser/error_reporting:mock_crash_endpoint",
]
......
......@@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//chrome/test/base/js2gtest.gni")
import("//chromeos/components/media_app_ui/media_app_ui.gni")
import("//chromeos/components/web_applications/system_apps.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/closure_compiler/compile_js.gni")
......@@ -171,3 +173,10 @@ js_library("test_media_app_guest_ui_browsertest_js") {
"//chromeos/components/system_apps/public/js:message_pipe",
]
}
# Used to turn off tests that only work with our CIPD package e.g. loading ink.
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [ "ENABLE_CROS_MEDIA_APP=$enable_cros_media_app" ]
}
......@@ -462,7 +462,7 @@ const base::Feature kMediaApp{"MediaApp", base::FEATURE_ENABLED_BY_DEFAULT};
// Whether image annotation is enabled in the ChromeOS media app.
const base::Feature kMediaAppAnnotation{"MediaAppAnnotation",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
// Whether known extensions for RAW image formats are handled by the ChromeOS
// Media App.
......
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