| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/extension_browsertest.h" | |
| 6 #include "chrome/browser/extensions/extension_service.h" | |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
| 8 #include "chrome/test/base/ui_test_utils.h" | |
| 9 #include "content/public/test/browser_test_utils.h" | |
| 10 | |
| 11 namespace extensions { | |
| 12 | |
| 13 // Test that opening a window with an extension recorded as active, then | |
| 14 // unloading the extension, all before the renderer is fully initialized, | |
| 15 // doesn't crash. This addresses crbug.com/528026, where messages could be sent | |
| 16 // out of order if an extension unloaded before the activation message was sent. | |
| 17 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, | |
| 18 TestRendererStartupWithConflictingMessages) { | |
| 19 // Load up an extension an begin opening an URL to a page within it. Since | |
| 20 // this will be an extension tab, the extension will be active within that | |
| 21 // process. | |
| 22 const Extension* extension = | |
| 23 LoadExtension(test_data_dir_.AppendASCII("simple_with_file")); | |
| 24 ASSERT_TRUE(extension); | |
| 25 GURL url = extension->GetResourceURL("file.html"); | |
| 26 browser()->OpenURL(content::OpenURLParams(url, content::Referrer(), | |
| 27 NEW_FOREGROUND_TAB, | |
| 28 ui::PAGE_TRANSITION_TYPED, false)); | |
| 29 // Without waiting for the tab to finish, unload the extension. | |
| 30 extension_service()->UnloadExtension(extension->id(), | |
| 31 UnloadedExtensionInfo::REASON_TERMINATE); | |
| 32 content::WebContents* web_contents = | |
| 33 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 34 // Wait for the web contents to stop loading. | |
| 35 content::WaitForLoadStop(web_contents); | |
| 36 EXPECT_EQ(url, web_contents->GetLastCommittedURL()); | |
| 37 ASSERT_FALSE(web_contents->IsCrashed()); | |
| 38 } | |
| 39 | |
| 40 } // namespace extensions | |
| OLD | NEW |