#include "base/format_macros.h"
#include <string>
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/search_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/omnibox/browser/autocomplete_controller.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_result.h"
#include "components/omnibox/browser/omnibox_controller.h"
#include "components/omnibox/browser/omnibox_edit_model.h"
#include "components/omnibox/browser/omnibox_feature_configs.h"
#include "components/omnibox/browser/omnibox_view.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
#include "ui/base/window_open_disposition.h"
namespace extensions {
namespace {
ASCIIToUTF16;
OmniboxEventProto;
WaitForAutocompleteDone;
void InputKeys(Browser* browser, const std::vector<ui::KeyboardCode>& keys) { … }
LocationBar* GetLocationBar(Browser* browser) { … }
std::u16string AutocompleteResultAsString(const AutocompleteResult& result) { … }
struct ExpectedMatchComponent { … };
ExpectedMatchComponents;
void VerifyMatchComponents(const ExpectedMatchComponents& expected,
const AutocompleteMatch& match) { … }
ContextType;
class OmniboxApiTest : public ExtensionApiTest,
public testing::WithParamInterface<ContextType> { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
OmniboxApiBackgroundPageTest;
INSTANTIATE_TEST_SUITE_P(…);
}
#if defined(THREAD_SANITIZER)
#define MAYBE_SendSuggestions …
#else
#define MAYBE_SendSuggestions …
#endif
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, MAYBE_SendSuggestions) { … }
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, OnInputEntered) { … }
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, IncognitoSplitMode) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_PopupStaysClosed …
#else
#define MAYBE_PopupStaysClosed …
#endif
IN_PROC_BROWSER_TEST_P(OmniboxApiBackgroundPageTest, MAYBE_PopupStaysClosed) { … }
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER))
#define MAYBE_DeleteOmniboxSuggestionResult …
#else
#define MAYBE_DeleteOmniboxSuggestionResult …
#endif
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, MAYBE_DeleteOmniboxSuggestionResult) { … }
IN_PROC_BROWSER_TEST_P(OmniboxApiTest,
DISABLED_ExtensionSuggestionsOnlyInKeywordMode) { … }
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, SetDefaultSuggestionFailures) { … }
#if (BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER))
#define MAYBE_SetDefaultSuggestion …
#else
#define MAYBE_SetDefaultSuggestion …
#endif
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, MAYBE_SetDefaultSuggestion) { … }
#if defined(THREAD_SANITIZER)
#define MAYBE_PassEmptySuggestions …
#else
#define MAYBE_PassEmptySuggestions …
#endif
IN_PROC_BROWSER_TEST_P(OmniboxApiTest, MAYBE_PassEmptySuggestions) { … }
}