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

Side by Side Diff: chrome/browser/extensions/extension_crash_recovery_browsertest.cc

Issue 301033004: replaced the string 'chrome-extensions://' with constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed yet another style issue Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser_process.h" 5 #include "chrome/browser/browser_process.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/notifications/notification.h" 8 #include "chrome/browser/notifications/notification.h"
9 #include "chrome/browser/notifications/notification_delegate.h" 9 #include "chrome/browser/notifications/notification_delegate.h"
10 #include "chrome/browser/notifications/notification_ui_manager.h" 10 #include "chrome/browser/notifications/notification_ui_manager.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_commands.h" 13 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/result_codes.h" 20 #include "content/public/common/result_codes.h"
21 #include "content/public/common/url_constants.h"
21 #include "extensions/browser/extension_host.h" 22 #include "extensions/browser/extension_host.h"
22 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
23 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
24 #include "extensions/browser/process_manager.h" 25 #include "extensions/browser/process_manager.h"
25 #include "extensions/browser/process_map.h" 26 #include "extensions/browser/process_map.h"
27 #include "extensions/common/constants.h"
26 #include "ui/message_center/message_center.h" 28 #include "ui/message_center/message_center.h"
27 #include "ui/message_center/notification_list.h" 29 #include "ui/message_center/notification_list.h"
28 30
29 using content::NavigationController; 31 using content::NavigationController;
30 using content::WebContents; 32 using content::WebContents;
31 using extensions::Extension; 33 using extensions::Extension;
32 using extensions::ExtensionRegistry; 34 using extensions::ExtensionRegistry;
33 35
34 // Tests are timing out waiting for extension to crash. 36 // Tests are timing out waiting for extension to crash.
35 // http://crbug.com/174705 37 // http://crbug.com/174705
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 MAYBE_ReloadTabsWithBackgroundPage) { 525 MAYBE_ReloadTabsWithBackgroundPage) {
524 TabStripModel* tab_strip = browser()->tab_strip_model(); 526 TabStripModel* tab_strip = browser()->tab_strip_model();
525 const size_t count_before = GetEnabledExtensionCount(); 527 const size_t count_before = GetEnabledExtensionCount();
526 const size_t crash_count_before = GetTerminatedExtensionCount(); 528 const size_t crash_count_before = GetTerminatedExtensionCount();
527 LoadTestExtension(); 529 LoadTestExtension();
528 530
529 // Open a tab extension. 531 // Open a tab extension.
530 chrome::NewTab(browser()); 532 chrome::NewTab(browser());
531 ui_test_utils::NavigateToURL( 533 ui_test_utils::NavigateToURL(
532 browser(), 534 browser(),
533 GURL("chrome-extension://" + first_extension_id_ + "/background.html")); 535 GURL(std::string(extensions::kExtensionScheme) +
536 content::kStandardSchemeSeparator + first_extension_id_ +
537 "/background.html"));
534 538
535 const int tabs_before = tab_strip->count(); 539 const int tabs_before = tab_strip->count();
536 CrashExtension(first_extension_id_); 540 CrashExtension(first_extension_id_);
537 541
538 // Tab should still be open, and extension should be crashed. 542 // Tab should still be open, and extension should be crashed.
539 EXPECT_EQ(tabs_before, tab_strip->count()); 543 EXPECT_EQ(tabs_before, tab_strip->count());
540 EXPECT_EQ(count_before, GetEnabledExtensionCount()); 544 EXPECT_EQ(count_before, GetEnabledExtensionCount());
541 EXPECT_EQ(crash_count_before + 1, GetTerminatedExtensionCount()); 545 EXPECT_EQ(crash_count_before + 1, GetTerminatedExtensionCount());
542 546
543 { 547 {
544 content::WindowedNotificationObserver observer( 548 content::WindowedNotificationObserver observer(
545 content::NOTIFICATION_LOAD_STOP, 549 content::NOTIFICATION_LOAD_STOP,
546 content::Source<NavigationController>( 550 content::Source<NavigationController>(
547 &browser()->tab_strip_model()->GetActiveWebContents()-> 551 &browser()->tab_strip_model()->GetActiveWebContents()->
548 GetController())); 552 GetController()));
549 chrome::Reload(browser(), CURRENT_TAB); 553 chrome::Reload(browser(), CURRENT_TAB);
550 observer.Wait(); 554 observer.Wait();
551 } 555 }
552 // Extension should now be loaded. 556 // Extension should now be loaded.
553 SCOPED_TRACE("after reloading the tab"); 557 SCOPED_TRACE("after reloading the tab");
554 CheckExtensionConsistency(first_extension_id_); 558 CheckExtensionConsistency(first_extension_id_);
555 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); 559 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount());
556 ASSERT_EQ(0U, CountBalloons()); 560 ASSERT_EQ(0U, CountBalloons());
557 } 561 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698