Commit 5563bea3 authored by Richard Knoll's avatar Richard Knoll Committed by Commit Bot

[Nearby] Add dummy nearby-confirmation-page component

This component will contain a confirmation screen when sending to
strangers that are not in the local contacts. The component is empty
right now and will be populated in upcoming CLs.

Bug: 1099710
Change-Id: I37325d2d75e897a0a9f8be0e6930bf0fd4305f02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270323Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Richard Knoll <knollr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783903}
parent c780fe89
...@@ -9,12 +9,14 @@ js_type_check("closure_compile") { ...@@ -9,12 +9,14 @@ js_type_check("closure_compile") {
is_polymer3 = true is_polymer3 = true
deps = [ deps = [
":app", ":app",
":nearby_confirmation_page",
":nearby_discovery_page", ":nearby_discovery_page",
] ]
} }
js_library("app") { js_library("app") {
deps = [ deps = [
":nearby_confirmation_page",
":nearby_discovery_page", ":nearby_discovery_page",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_components/nearby_share:nearby_onboarding_page.m", "//ui/webui/resources/cr_components/nearby_share:nearby_onboarding_page.m",
...@@ -22,6 +24,12 @@ js_library("app") { ...@@ -22,6 +24,12 @@ js_library("app") {
] ]
} }
js_library("nearby_confirmation_page") {
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
js_library("nearby_discovery_page") { js_library("nearby_discovery_page") {
deps = [ deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
...@@ -31,6 +39,7 @@ js_library("nearby_discovery_page") { ...@@ -31,6 +39,7 @@ js_library("nearby_discovery_page") {
html_to_js("web_components") { html_to_js("web_components") {
js_files = [ js_files = [
"app.js", "app.js",
"nearby_confirmation_page.js",
"nearby_discovery_page.js", "nearby_discovery_page.js",
] ]
} }
<cr-view-manager id="viewManager"> <cr-view-manager id="viewManager">
<nearby-confirmation-page id="[[Page.CONFIRMATION]]" slot="view">
</nearby-confirmation-page>
<nearby-discovery-page id="[[Page.DISCOVERY]]" slot="view" class="active"> <nearby-discovery-page id="[[Page.DISCOVERY]]" slot="view" class="active">
</nearby-discovery-page> </nearby-discovery-page>
<nearby-onboarding-page id="[[Page.ONBOARDING]]" slot="view"> <nearby-onboarding-page id="[[Page.ONBOARDING]]" slot="view">
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import 'chrome://resources/cr_components/nearby_share/nearby_onboarding_page.m.js'; import 'chrome://resources/cr_components/nearby_share/nearby_onboarding_page.m.js';
import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js'; import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js';
import './nearby_confirmation_page.js';
import './nearby_discovery_page.js'; import './nearby_discovery_page.js';
import './strings.m.js'; import './strings.m.js';
...@@ -17,6 +18,7 @@ import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bun ...@@ -17,6 +18,7 @@ import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bun
/** @enum {string} */ /** @enum {string} */
const Page = { const Page = {
CONFIRMATION: 'confirmation',
DISCOVERY: 'discovery', DISCOVERY: 'discovery',
ONBOARDING: 'onboarding', ONBOARDING: 'onboarding',
}; };
......
// 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.
/**
* @fileoverview The 'nearby-confirmation-page' component shows a confirmation
* screen when sending data to a stranger. Strangers are devices of people that
* are not currently in the contacts of this user.
*/
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
Polymer({
is: 'nearby-confirmation-page',
_template: html`{__html_template__}`,
});
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
<include name="IDR_NEARBY_SHARE_APP_JS" <include name="IDR_NEARBY_SHARE_APP_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/app.js" file="${root_gen_dir}/chrome/browser/resources/nearby_share/app.js"
use_base_dir="false" type="BINDATA"/> use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_CONFIRMATION_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_confirmation_page.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_DISCOVERY_PAGE_JS" <include name="IDR_NEARBY_SHARE_NEARBY_DISCOVERY_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_discovery_page.js" file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_discovery_page.js"
use_base_dir="false" type="BINDATA"/> use_base_dir="false" type="BINDATA"/>
......
...@@ -254,6 +254,7 @@ if (include_js_tests) { ...@@ -254,6 +254,7 @@ if (include_js_tests) {
"media/media_engagement_browsertest.js", "media/media_engagement_browsertest.js",
"media/media_feeds_webui_browsertest.js", "media/media_feeds_webui_browsertest.js",
"media/media_history_webui_browsertest.js", "media/media_history_webui_browsertest.js",
"nearby_share/nearby_browsertest.js",
"new_tab_page/new_tab_page_browsertest.js", "new_tab_page/new_tab_page_browsertest.js",
"usb_internals_browsertest.js", "usb_internals_browsertest.js",
] ]
...@@ -349,6 +350,7 @@ group("closure_compile") { ...@@ -349,6 +350,7 @@ group("closure_compile") {
":closure_compile_local", ":closure_compile_local",
"cr_components:closure_compile", "cr_components:closure_compile",
"cr_elements:closure_compile", "cr_elements:closure_compile",
"nearby_share:closure_compile",
"print_preview:closure_compile", "print_preview:closure_compile",
"settings:closure_compile", "settings:closure_compile",
"tab_strip:closure_compile", "tab_strip:closure_compile",
......
# 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.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
is_polymer3 = true
closure_flags = default_closure_args + [
"browser_resolver_prefix_replacements=\"chrome://nearby/=../../chrome/browser/resources/nearby_share/\"",
"js_module_root=../../chrome/test/data/webui/",
"js_module_root=./gen/chrome/test/data/webui/",
]
deps = [ ":nearby_confirmation_page_test" ]
}
js_library("nearby_confirmation_page_test") {
deps = [ "//chrome/browser/resources/nearby_share:nearby_confirmation_page" ]
externs_list = [ "$externs_path/mocha-2.5.js" ]
}
file://chrome/browser/nearby_sharing/OWNERS
# COMPONENT: UI>Browser>Sharing>Nearby
// 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.
/** @fileoverview Runs the Polymer Nearby Share WebUI tests. */
// Polymer BrowserTest fixture.
GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']);
GEN('#include "chrome/browser/browser_features.h"');
GEN('#include "content/public/test/browser_test.h"');
/** Test fixture for Polymer Nearby Share elements. */
const NearbyBrowserTest = class extends PolymerTest {
/** @override */
get browsePreload() {
throw 'this is abstract and should be overridden by subclasses';
}
/**
* Override default |extraLibraries| since PolymerTest includes more than are
* needed in JS Module based tests.
* @override
*/
get extraLibraries() {
return [
'//third_party/mocha/mocha.js',
'//chrome/test/data/webui/mocha_adapter.js',
];
}
/** @override */
get webuiHost() {
return 'nearby';
}
/** @override */
get featureList() {
return {enabled: ['features::kNearbySharing']};
}
};
[['ConfirmationPage', 'nearby_confirmation_page_test.js'],
].forEach(test => registerTest(...test));
function registerTest(testName, module, caseName) {
const className = `Nearby${testName}Test`;
this[className] = class extends NearbyBrowserTest {
/** @override */
get browsePreload() {
return `chrome://nearby/test_loader.html?module=nearby_share/${module}`;
}
};
TEST_F(className, caseName || 'All', () => mocha.run());
}
// 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.
// So that mojo is defined.
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://nearby/nearby_confirmation_page.js';
import {assertEquals} from '../chai_assert.js';
suite('ConfirmatonPageTest', function() {
/** @type {!NearbyConfirmationPageElement} */
let confirmationPageElement;
setup(function() {
confirmationPageElement = /** @type {!NearbyConfirmationPageElement} */ (
document.createElement('nearby-confirmation-page'));
document.body.appendChild(confirmationPageElement);
});
teardown(function() {
confirmationPageElement.remove();
});
test('renders component', function() {
assertEquals('NEARBY-CONFIRMATION-PAGE', confirmationPageElement.tagName);
});
});
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