Commit 91aa111e authored by Wei Lee's avatar Wei Lee Committed by Commit Bot

Reland "[CCA WebUI] Don't capture navigation other than main page URL for CCA"

This reverts commit 79e008a0.

Reason for revert: The CL is reverted but the failure (SystemWebAppManagerUpgradeBrowserTest.Upgrade/WebApps) does not fix:
https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-chrome/9028
So it is very likely that the CL is not the culprit.

Original change's description:
> Revert "[CCA WebUI] Don't capture navigation other than main page URL for CCA"
>
> This reverts commit ab12c6e3.
>
> Reason for revert: Breaks browser_tests: SystemWebAppManagerUpgradeBrowserTest.Upgrade/WebApps
> https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-chrome/9011
>
> Original change's description:
> > [CCA WebUI] Don't capture navigation other than main page URL for CCA
> >
> > We have the following requirements:
> > 1. We prefer loading CCA UI in the app window rather than browser tab
> >   => Therefore we added "capture_navigation=true" for CCA
> > 2. We don't want to load resource URLs or invalid URL in the app window
> >   => Short term: Landing this CL to filter out unwanted URLs
> >
> >   We decide not to support URL filtering feature for capture navigation
> >   since only camera app has such requirement at this moment.
> >   (crbug.com/1132151)
> >
> > Bug: 980846
> > Test: Type CCA url other than chrome://camera-app/views/main.html and
> > the page is loaded in browser tab
> >
> > Change-Id: I467aa1498aa9fe975d34bdf82adee7f6dff6a14c
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440076
> > Commit-Queue: Wei Lee <wtlee@chromium.org>
> > Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
> > Reviewed-by: Jiewei Qian  <qjw@chromium.org>
> > Auto-Submit: Wei Lee <wtlee@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#814557}
>
> TBR=ortuno@chromium.org,wtlee@chromium.org,qjw@chromium.org
>
> Change-Id: I12e4bbd7ee461e7ed0a3d0664e90ca3e4ea435f9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 980846
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2457586
> Reviewed-by: Ella Ge <eirage@chromium.org>
> Commit-Queue: Ella Ge <eirage@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#814741}

TBR=ortuno@chromium.org,eirage@chromium.org,wtlee@chromium.org,qjw@chromium.org

# Not skipping CQ checks because this is a reland.

Bug: 980846
Change-Id: Ia0244f12f8d12c03184b73c27e374072b8c76b09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460250Reviewed-by: default avatarWei Lee <wtlee@chromium.org>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815033}
parent 07f082ff
......@@ -5,10 +5,13 @@
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/chromeos/web_applications/system_web_app_integration_test.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/web_applications/system_web_app_manager_browsertest.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chromeos/constants/chromeos_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_navigation_observer.h"
class CameraAppIntegrationTest : public SystemWebAppIntegrationTest {
public:
......@@ -32,5 +35,42 @@ IN_PROC_BROWSER_TEST_P(CameraAppIntegrationTest, WindowNotResizeable) {
EXPECT_FALSE(browser_view->CanResize());
}
IN_PROC_BROWSER_TEST_P(CameraAppIntegrationTest, MainUrlNavigation) {
WaitForTestSystemAppInstall();
GURL main_camera_app_url("chrome://camera-app/views/main.html");
content::TestNavigationObserver navigation_observer(main_camera_app_url);
navigation_observer.StartWatchingNewWebContents();
ASSERT_EQ(1u, chrome::GetTotalBrowserCount());
ui_test_utils::SendToOmniboxAndSubmit(browser(), main_camera_app_url.spec());
navigation_observer.Wait();
// We now have two browsers, one for the chrome window, one for the Camera
// app.
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(main_camera_app_url, chrome::FindLastActive()
->tab_strip_model()
->GetActiveWebContents()
->GetVisibleURL());
}
IN_PROC_BROWSER_TEST_P(CameraAppIntegrationTest, OtherPageUrlNavigation) {
WaitForTestSystemAppInstall();
// TODO(crbug.com/980846): Change it to test page once the corresponding CL is
// merged.
GURL other_page_camera_app_url("chrome://camera-app/js/main.js");
ASSERT_EQ(1u, chrome::GetTotalBrowserCount());
ui_test_utils::SendToOmniboxAndSubmit(browser(),
other_page_camera_app_url.spec());
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(
other_page_camera_app_url,
browser()->tab_strip_model()->GetActiveWebContents()->GetVisibleURL());
}
INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_MANIFEST_INSTALL_P(
CameraAppIntegrationTest);
......@@ -44,6 +44,7 @@ source_set("common") {
if (is_chromeos) {
deps += [
"//ash/public/cpp",
"//chromeos/components/camera_app_ui",
"//chromeos/components/diagnostics_ui",
"//chromeos/components/help_app_ui",
"//chromeos/components/media_app_ui",
......
......@@ -54,6 +54,7 @@
#include "chrome/browser/chromeos/web_applications/scanning_system_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/terminal_source.h"
#include "chrome/browser/chromeos/web_applications/terminal_system_web_app_info.h"
#include "chromeos/components/camera_app_ui/url_constants.h"
#include "chromeos/components/help_app_ui/url_constants.h"
#include "chromeos/components/media_app_ui/url_constants.h"
#include "chromeos/constants/chromeos_features.h"
......@@ -624,6 +625,12 @@ base::Optional<SystemAppType> SystemWebAppManager::GetCapturingSystemAppForURL(
if (!it->second.capture_navigations)
return base::nullopt;
#if defined(OS_CHROMEOS)
if (type == SystemAppType::CAMERA &&
url.spec() != chromeos::kChromeUICameraAppMainURL)
return base::nullopt;
#endif // defined(OS_CHROMEOS)
return type;
}
......
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