#include "chrome/browser/extensions/error_console/error_console.h"
#include <stddef.h>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/prefs/pref_service.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/extension_error.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_constants.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
UTF8ToUTF16;
u16string;
namespace extensions {
namespace {
const char kTestingPage[] = …;
const char kAnonymousFunction[] = …;
const char* const kBackgroundPageName = …;
const StackTrace& GetStackTraceFromError(const ExtensionError* error) { … }
void CheckStackFrame(const StackFrame& frame,
const std::string& source,
const std::string& function) { … }
void CheckStackFrame(const StackFrame& frame,
const std::string& source,
const std::string& function,
size_t line_number,
size_t column_number) { … }
void CheckError(const ExtensionError* error,
ExtensionError::Type type,
const std::string& id,
const std::string& source,
bool from_incognito,
const std::string& message) { … }
void CheckRuntimeError(const ExtensionError* error,
const std::string& id,
const std::string& source,
bool from_incognito,
const std::string& message,
logging::LogSeverity level,
const GURL& context,
size_t expected_stack_size) { … }
void CheckManifestError(const ExtensionError* error,
const std::string& id,
const std::string& message,
const std::string& manifest_key,
const std::string& manifest_specific) { … }
void CheckDeprecatedManifestVersionError(const ExtensionError* error,
const std::string& id) { … }
}
class ErrorConsoleBrowserTest : public ExtensionBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, ReportManifestErrors) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest,
DontStoreErrorsWithoutDeveloperMode) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest,
ContentScriptLogAndRuntimeError) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BrowserActionRuntimeError) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BadAPIArgumentsRuntimeError) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BadAPIPermissionsRuntimeError) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BadExtensionPage) { … }
IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, DISABLED_CatchesLastError) { … }
}