| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/error_console/error_console.h" | 5 #include "chrome/browser/extensions/error_console/error_console.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 std::string script_url = extension->url().Resolve("background.js").spec(); | 521 std::string script_url = extension->url().Resolve("background.js").spec(); |
| 522 | 522 |
| 523 const ErrorList& errors = | 523 const ErrorList& errors = |
| 524 error_console()->GetErrorsForExtension(extension->id()); | 524 error_console()->GetErrorsForExtension(extension->id()); |
| 525 | 525 |
| 526 CheckRuntimeError( | 526 CheckRuntimeError( |
| 527 errors[0], | 527 errors[0], |
| 528 extension->id(), | 528 extension->id(), |
| 529 script_url, | 529 script_url, |
| 530 false, // not incognito | 530 false, // not incognito |
| 531 "Uncaught TypeError: Cannot call method 'addUrl' of undefined", | 531 "Uncaught TypeError: Cannot read property 'addUrl' of undefined", |
| 532 logging::LOG_ERROR, | 532 logging::LOG_ERROR, |
| 533 extension->url().Resolve(kBackgroundPageName), | 533 extension->url().Resolve(kBackgroundPageName), |
| 534 1u); | 534 1u); |
| 535 | 535 |
| 536 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); | 536 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); |
| 537 ASSERT_EQ(1u, stack_trace.size()); | 537 ASSERT_EQ(1u, stack_trace.size()); |
| 538 CheckStackFrame(stack_trace[0], | 538 CheckStackFrame(stack_trace[0], |
| 539 script_url, | 539 script_url, |
| 540 kAnonymousFunction, | 540 kAnonymousFunction, |
| 541 5u, 1u); | 541 5u, 1u); |
| 542 } | 542 } |
| 543 | 543 |
| 544 IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BadExtensionPage) { | 544 IN_PROC_BROWSER_TEST_F(ErrorConsoleBrowserTest, BadExtensionPage) { |
| 545 const Extension* extension = NULL; | 545 const Extension* extension = NULL; |
| 546 LoadExtensionAndCheckErrors( | 546 LoadExtensionAndCheckErrors( |
| 547 "bad_extension_page", | 547 "bad_extension_page", |
| 548 kNoFlags, | 548 kNoFlags, |
| 549 1, // One error: the page will load JS which has a reference error. | 549 1, // One error: the page will load JS which has a reference error. |
| 550 ACTION_NEW_TAB, | 550 ACTION_NEW_TAB, |
| 551 &extension); | 551 &extension); |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace extensions | 554 } // namespace extensions |
| OLD | NEW |