-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 20241029-serving-attachments
- Loading branch information
Showing
8 changed files
with
416 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
import testing_config # Must be imported before the module under test. | ||
|
||
from flask import render_template | ||
from unittest import mock | ||
|
||
import os | ||
|
@@ -248,16 +249,30 @@ class IntentEmailPreviewTemplateTest(testing_config.CustomTestCase): | |
def setUp(self): | ||
super(IntentEmailPreviewTemplateTest, self).setUp() | ||
self.feature_1 = FeatureEntry( | ||
name='feature one', summary='sum', owner_emails=['[email protected]'], | ||
id=234, name='feature one', summary='sum', | ||
owner_emails=['[email protected]'], feature_type=0, | ||
category=1, intent_stage=core_enums.INTENT_IMPLEMENT) | ||
# Hardcode the key for the template test | ||
self.feature_1.key = ndb.Key('FeatureEntry', 234) | ||
self.feature_1.wpt = True | ||
self.feature_1.wpt_descr = 'We love WPT!' | ||
self.feature_1.put() | ||
|
||
self.stage_1 = Stage(id=100, feature_id=234, stage_type=150, | ||
ot_display_name="Test 123") | ||
self.stage_1.put() | ||
self.gate_1 = Gate(id=101, feature_id=234, stage_id=100, | ||
gate_type=3, state=Vote.NA) | ||
self.gate_1.put() | ||
|
||
self.stage_2 = Stage(id=200, feature_id=234, stage_type=110) | ||
self.stage_2.put() | ||
self.gate_2 = Gate(id=201, feature_id=234, stage_id=100, | ||
gate_type=1, state=Vote.NA) | ||
self.gate_2.put() | ||
self.request_path = '/admin/features/launch/%d/%d?intent' % ( | ||
core_enums.INTENT_SHIP, self.feature_1.key.integer_id()) | ||
self.intent_preview_path = 'blink/intent_to_implement.html' | ||
self.handler = self.HANDLER_CLASS() | ||
self.feature_id = self.feature_1.key.integer_id() | ||
|
||
|
@@ -276,7 +291,9 @@ def setUp(self): | |
self.maxDiff = None | ||
|
||
def tearDown(self): | ||
self.feature_1.key.delete() | ||
for kind in [FeatureEntry, Gate, Stage]: | ||
for entity in kind.query(): | ||
entity.key.delete() | ||
testing_config.sign_out() | ||
|
||
def test_html_rendering(self): | ||
|
@@ -297,3 +314,39 @@ def test_html_rendering(self): | |
# TESTDATA.make_golden(template_text, 'test_html_rendering.html') | ||
self.assertMultiLineEqual( | ||
TESTDATA['test_html_rendering.html'], template_text) | ||
|
||
def test_template_rendering_prototype(self): | ||
"""We can render the prototype template with valid html.""" | ||
with test_app.test_request_context(self.request_path): | ||
actual_data = self.handler.get_template_data( | ||
feature_id=self.feature_id, | ||
intent_stage=core_enums.INTENT_IMPLEMENT, | ||
gate_id=self.gate_2.key.integer_id()) | ||
actual_data.update(self.handler.get_common_data()) | ||
actual_data['nonce'] = 'fake nonce' | ||
actual_data['xsrf_token'] = '' | ||
actual_data['xsrf_token_expires'] = 0 | ||
|
||
body = render_template(self.intent_preview_path, **actual_data) | ||
testing_config.sign_out() | ||
# TESTDATA.make_golden(body, 'test_html_prototype_rendering.html') | ||
self.assertMultiLineEqual( | ||
TESTDATA['test_html_prototype_rendering.html'], body) | ||
|
||
def test_template_rendering_origin_trial(self): | ||
"""We can render the origin trial intent template.""" | ||
with test_app.test_request_context(self.request_path): | ||
actual_data = self.handler.get_template_data( | ||
feature_id=self.feature_id, | ||
intent_stage=core_enums.INTENT_ORIGIN_TRIAL, | ||
gate_id=self.gate_1.key.integer_id()) | ||
actual_data.update(self.handler.get_common_data()) | ||
actual_data['nonce'] = 'fake nonce' | ||
actual_data['xsrf_token'] = '' | ||
actual_data['xsrf_token_expires'] = 0 | ||
|
||
body = render_template(self.intent_preview_path, **actual_data) | ||
testing_config.sign_out() | ||
# TESTDATA.make_golden(body, 'test_html_ot_rendering.html') | ||
self.assertMultiLineEqual( | ||
TESTDATA['test_html_ot_rendering.html'], body) |
169 changes: 169 additions & 0 deletions
169
pages/testdata/intentpreview_test/test_html_ot_rendering.html
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,169 @@ | ||
<h4>Contact emails</h4> | ||
|
||
|
||
<a href="mailto:[email protected]">[email protected]</a> | ||
|
||
|
||
|
||
<br><br><h4>Explainer</h4> | ||
None | ||
|
||
|
||
|
||
<br><br><h4>Specification</h4> | ||
None | ||
|
||
|
||
|
||
<br><br><h4>Summary</h4> | ||
<p class="preformatted">sum</p> | ||
|
||
<br><br><h4>Blink component</h4> | ||
|
||
<a href="https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink" target="_blank" rel="noopener">Blink</a> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>TAG review</h4> | ||
None | ||
|
||
|
||
<br><br><h4>TAG review status</h4> | ||
Pending | ||
|
||
|
||
|
||
|
||
<br><br><h4>Origin Trial Name</h4> | ||
Test 123 | ||
|
||
|
||
|
||
<br><br><h4>Risks</h4> | ||
<div style="margin-left: 4em;"> | ||
<br><br><h4>Interoperability and Compatibility</h4> | ||
<p class="preformatted">None</p> | ||
|
||
<br><br><i>Gecko</i>: No signal | ||
|
||
|
||
|
||
<br><br><i>WebKit</i>: No signal | ||
|
||
|
||
|
||
<br><br><i>Web developers</i>: No signals | ||
|
||
|
||
|
||
<br><br><i>Other signals</i>: | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>WebView application risks</h4> | ||
<p style="font-style: italic"> | ||
Does this intent deprecate or change behavior of existing APIs, | ||
such that it has potentially high risk for Android WebView-based | ||
applications?</p> | ||
<p class="preformatted">None</p> | ||
|
||
</div> <!-- end risks --> | ||
|
||
|
||
|
||
<br><br><h4>Goals for experimentation</h4> | ||
<p class="preformatted"></p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>Ongoing technical constraints</h4> | ||
<p class="preformatted">None</p> | ||
|
||
|
||
|
||
<br><br><h4>Debuggability</h4> | ||
<p class="preformatted">None</p> | ||
|
||
|
||
<br><br><h4>Will this feature be supported on all six Blink platforms | ||
(Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?</h4> | ||
No | ||
|
||
|
||
|
||
<br><br><h4>Is this feature fully tested by <a href="https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md">web-platform-tests</a>?</h4> | ||
Yes | ||
|
||
<p class="preformatted">We love WPT!</p> | ||
|
||
|
||
|
||
|
||
<br><br><h4>Flag name on about://flags</h4> | ||
None | ||
|
||
<br><br><h4>Finch feature name</h4> | ||
None | ||
|
||
|
||
|
||
<br><br><h4>Non-finch justification</h4> | ||
None | ||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>Requires code in //chrome?</h4> | ||
False | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>Estimated milestones</h4> | ||
|
||
|
||
<p>No milestones specified</p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br><h4>Link to entry on the Local testing</h4> | ||
<a href="http://localhost/feature/234?gate=101">http://localhost/feature/234?gate=101</a> | ||
|
||
|
||
|
||
|
||
<br><br><div><small> | ||
This intent message was generated by | ||
<a href="https://chromestatus.com">Chrome Platform Status</a>. | ||
</small></div> |
Oops, something went wrong.