#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/feedback/feedback_dialog_utils.h"
#include "chrome/browser/feedback/feedback_uploader_chrome.h"
#include "chrome/browser/feedback/feedback_uploader_factory_chrome.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api/feedback_private/feedback_private_api.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/api/feedback_private.h"
FeedbackFlow;
namespace extensions {
class FeedbackTest : public ExtensionBrowserTest { … };
class TestFeedbackUploaderDelegate
: public feedback::FeedbackUploaderChrome::Delegate { … };
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_ShowFeedback) { … }
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_ShowLoginFeedback) { … }
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_AnonymousUser) { … }
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_ExtraDiagnostics) { … }
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_ShowFeedbackFromAssistant) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_ProvideBluetoothLogs) {
WaitForExtensionViewsToLoad();
ASSERT_TRUE(IsFeedbackAppAvailable());
StartFeedbackUI(FeedbackFlow::kGoogleInternal, std::string(),
false, true);
VerifyFeedbackAppLaunch();
AppWindow* const window =
PlatformAppBrowserTest::GetFirstAppWindowForBrowser(browser());
ASSERT_TRUE(window);
content::WebContents* const content = window->web_contents();
EXPECT_EQ(true,
content::EvalJs(
content,
"((function() {"
" if ($('bluetooth-checkbox-container') != null &&"
" $('bluetooth-checkbox-container').hidden == true) {"
" return true;"
" }"
" return false;"
" })());"));
EXPECT_EQ(true,
content::EvalJs(
content,
"((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;"
" })());"));
}
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_AppendQuestionnaire) {
WaitForExtensionViewsToLoad();
ASSERT_TRUE(IsFeedbackAppAvailable());
StartFeedbackUI(FeedbackFlow::kGoogleInternal, std::string(),
false, true,
true);
VerifyFeedbackAppLaunch();
AppWindow* const window =
PlatformAppBrowserTest::GetFirstAppWindowForBrowser(browser());
ASSERT_TRUE(window);
content::WebContents* const content = window->web_contents();
EXPECT_EQ(
true,
content::EvalJs(
content,
"((function() {"
" return !$('description-text').value.includes('please answer');"
" })());"));
EXPECT_EQ(true,
content::EvalJs(
content,
"((function() {"
" var elem = document.getElementById('description-text');"
" elem.value = 'bluetooth';"
" elem.dispatchEvent(new Event('input', {}));"
" return elem.value.includes('please answer')"
" && elem.value.includes('[Bluetooth]')"
" && !elem.value.includes('[WiFi]');"
" })());"));
EXPECT_EQ(true,
content::EvalJs(
content,
"((function() {"
" var elem = document.getElementById('description-text');"
" elem.value = 'wifi issue';"
" elem.dispatchEvent(new Event('input', {}));"
" return elem.value.includes('[WiFi]');"
" })());"));
}
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_AppendQuestionnaireNotGoogler) {
WaitForExtensionViewsToLoad();
ASSERT_TRUE(IsFeedbackAppAvailable());
StartFeedbackUI(FeedbackFlow::kRegular, std::string(),
false, false,
false);
VerifyFeedbackAppLaunch();
AppWindow* const window =
PlatformAppBrowserTest::GetFirstAppWindowForBrowser(browser());
ASSERT_TRUE(window);
content::WebContents* const content = window->web_contents();
EXPECT_EQ(
true,
content::EvalJs(
content,
"((function() {"
" return !$('description-text').value.includes('[Bluetooth]');"
" })()));"));
EXPECT_EQ(true,
content::EvalJs(
content,
"((function() {"
" var elem = document.getElementById('description-text');"
" elem.value = 'bluetooth';"
" elem.dispatchEvent(new Event('input', {}));"
" return !elem.value.includes('please answer');"
" })());"));
}
#endif
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_GetTargetTabUrl) { … }
IN_PROC_BROWSER_TEST_F(FeedbackTest, DISABLED_SubmissionTest) { … }
}