Commit c001ea6d authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Commit Bot

Test that we show the 'Attach Bluetooth Logs' option in feedback

This adds a browser test that verified that for Google emails, when
somebody enters text similar to 'bluetooth' into the description field
that we then show the option for attaching bluetooth logs.

Bug: None
Test: browser_tests pass
Change-Id: I8eea58d8936eacba9bbd2608d333d15ac06e93dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1621352
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662240}
parent ad73e3c3
......@@ -59,10 +59,12 @@ class FeedbackTest : public ExtensionBrowserTest {
void StartFeedbackUI(FeedbackFlow flow,
const std::string& extra_diagnostics,
bool from_assistant = false) {
bool from_assistant = false,
bool include_bluetooth_logs = false) {
base::Closure callback = base::Bind(&StopMessageLoopCallback);
extensions::FeedbackPrivateGetStringsFunction::set_test_callback(&callback);
InvokeFeedbackUI(flow, extra_diagnostics, from_assistant);
InvokeFeedbackUI(flow, extra_diagnostics, from_assistant,
include_bluetooth_logs);
content::RunMessageLoop();
extensions::FeedbackPrivateGetStringsFunction::set_test_callback(NULL);
}
......@@ -80,13 +82,15 @@ class FeedbackTest : public ExtensionBrowserTest {
private:
void InvokeFeedbackUI(FeedbackFlow flow,
const std::string& extra_diagnostics,
bool from_assistant) {
bool from_assistant,
bool include_bluetooth_logs) {
extensions::FeedbackPrivateAPI* api =
extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(
browser()->profile());
api->RequestFeedbackForFlow(
"Test description", "Test placeholder", "Test tag", extra_diagnostics,
GURL("http://www.test.com"), flow, from_assistant);
api->RequestFeedbackForFlow("Test description", "Test placeholder",
"Test tag", extra_diagnostics,
GURL("http://www.test.com"), flow,
from_assistant, include_bluetooth_logs);
}
};
......@@ -249,6 +253,57 @@ IN_PROC_BROWSER_TEST_F(FeedbackTest, MAYBE_ShowFeedbackFromAssistant) {
EXPECT_TRUE(bool_result);
}
#if defined(OS_CHROMEOS)
// Ensures that when triggered from a Google account and a Bluetooth related
// string is entered into the description, that we provide the option for
// uploading Bluetooth logs as well.
IN_PROC_BROWSER_TEST_F(FeedbackTest, ProvideBluetoothLogs) {
WaitForExtensionViewsToLoad();
ASSERT_TRUE(IsFeedbackAppAvailable());
StartFeedbackUI(FeedbackFlow::FEEDBACK_FLOW_GOOGLEINTERNAL, std::string(),
/*from_assistant*/ false, /*include_bluetooth_logs*/ true);
VerifyFeedbackAppLaunch();
AppWindow* const window =
PlatformAppBrowserTest::GetFirstAppWindowForBrowser(browser());
ASSERT_TRUE(window);
content::WebContents* const content = window->web_contents();
// It shouldn't be visible until we put the Bluetooth text into the
// description.
bool bool_result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
content,
"domAutomationController.send("
" ((function() {"
" if ($('bluetooth-checkbox-container') != null &&"
" $('bluetooth-checkbox-container').hidden == true) {"
" return true;"
" }"
" return false;"
" })()));",
&bool_result));
EXPECT_TRUE(bool_result);
bool_result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
content,
"domAutomationController.send("
" ((function() {"
" var elem = document.getElementById('description-text');"
" elem.value = 'bluetooth';"
" elem.dispatchEvent(new Event('input', {}));"
" if ($('bluetooth-checkbox-container') != null &&"
" $('bluetooth-checkbox-container').hidden == false) {"
" return true;"
" }"
" return false;"
" })()));",
&bool_result));
EXPECT_TRUE(bool_result);
}
#endif // if defined(CHROME_OS)
IN_PROC_BROWSER_TEST_F(FeedbackTest, GetTargetTabUrl) {
const std::pair<std::string, std::string> test_cases[] = {
{"https://www.google.com/", "https://www.google.com/"},
......
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