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

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

Issue 2355183002: [Extensions] Don't run unload listeners when an extension is removed (Closed)
Patch Set: Remove terminated extensions reference Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/fast_unload_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "ui/base/window_open_disposition.h"
10
11 namespace extensions {
12
13 using ExtensionUnloadBrowserTest = ExtensionBrowserTest;
14
15 IN_PROC_BROWSER_TEST_F(ExtensionUnloadBrowserTest, TestUnload) {
16 // Load an extension that installs unload and beforeunload listeners.
17 const Extension* extension =
18 LoadExtension(test_data_dir_.AppendASCII("unload_listener"));
19 ASSERT_TRUE(extension);
20 std::string id = extension->id();
21 ASSERT_EQ(1, browser()->tab_strip_model()->count());
22 GURL initial_tab_url =
23 browser()->tab_strip_model()->GetWebContentsAt(0)->GetLastCommittedURL();
24 ui_test_utils::NavigateToURLWithDisposition(
25 browser(), extension->GetResourceURL("page.html"),
26 WindowOpenDisposition::NEW_FOREGROUND_TAB,
27 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
28 EXPECT_EQ(2, browser()->tab_strip_model()->count());
29 extension_service()->UnloadExtension(id,
30 UnloadedExtensionInfo::REASON_DISABLE);
31 // There should only be one remaining web contents - the initial one.
32 ASSERT_EQ(1, browser()->tab_strip_model()->count());
33 EXPECT_EQ(
34 initial_tab_url,
35 browser()->tab_strip_model()->GetWebContentsAt(0)->GetLastCommittedURL());
36 }
37
38 // TODO(devlin): Investigate what to do for embedded iframes.
39
40 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/fast_unload_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698