Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: chrome/browser/extensions/error_console/error_console_unittest.cc

Issue 23007021: Report Javascript Runtime Errors to the Error Console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_feldman
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/error_console/error_console_unittest.cc
diff --git a/chrome/browser/extensions/error_console/error_console_unittest.cc b/chrome/browser/extensions/error_console/error_console_unittest.cc
index e79c96fd7e18b27cba7da5a374f29264579b77b8..dc880f9d94cb9f73250c03b4fec87f6e41408abc 100644
--- a/chrome/browser/extensions/error_console/error_console_unittest.cc
+++ b/chrome/browser/extensions/error_console/error_console_unittest.cc
@@ -20,28 +20,30 @@
#include "extensions/common/constants.h"
#include "extensions/common/id_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
using base::string16;
-using base::UTF8ToUTF16;
namespace extensions {
namespace {
-const char kExecutionContextURLKey[] = "executionContextURL";
-const char kStackTraceKey[] = "stackTrace";
+const char kDefaultStackTrace[] = "function_name (https://url.com:1:1)";
-string16 CreateErrorDetails(const std::string& extension_id) {
- base::DictionaryValue value;
- value.SetString(
- kExecutionContextURLKey,
+StackTrace GetDefaultStackTrace() {
+ StackTrace stack_trace;
+ scoped_ptr<StackFrame> frame =
+ StackFrame::CreateFromText(base::UTF8ToUTF16(kDefaultStackTrace));
+ CHECK(frame.get());
+ stack_trace.push_back(*frame);
+ return stack_trace;
+}
+
+string16 GetSourceForExtensionId(const std::string& extension_id) {
+ return base::UTF8ToUTF16(
std::string(kExtensionScheme) +
- content::kStandardSchemeSeparator +
- extension_id);
- value.Set(kStackTraceKey, new ListValue);
- std::string json_utf8;
- base::JSONWriter::Write(&value, &json_utf8);
- return UTF8ToUTF16(json_utf8);
+ content::kStandardSchemeSeparator +
+ extension_id);
}
scoped_ptr<ExtensionError> CreateNewRuntimeError(
@@ -50,10 +52,11 @@ scoped_ptr<ExtensionError> CreateNewRuntimeError(
const string16& message) {
return scoped_ptr<ExtensionError>(new RuntimeError(
from_incognito,
- UTF8ToUTF16("source"),
+ GetSourceForExtensionId(extension_id),
message,
- logging::LOG_INFO,
- CreateErrorDetails(extension_id)));
+ GetDefaultStackTrace(),
+ GURL::EmptyGURL(), // no context url
+ logging::LOG_INFO));
}
} // namespace
« no previous file with comments | « chrome/browser/extensions/error_console/error_console_browsertest.cc ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698