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

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

Issue 2037873002: [Extensions] Observe unloading extensions in the TabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Istiaque's Created 4 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
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/chrome_tests_unit.gypi » ('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/tab_helper.h"
6
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_service_test_with_install.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/test/web_contents_tester.h"
11
12 namespace extensions {
13
14 TEST_F(ExtensionServiceTestWithInstall, TabHelperClearsExtensionOnUnload) {
15 InitializeEmptyExtensionService();
16 const Extension* extension =
17 PackAndInstallCRX(data_dir().AppendASCII("hosted_app"), INSTALL_NEW);
18 ASSERT_TRUE(extension);
19 std::unique_ptr<content::WebContents> web_contents(
20 content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
21 TabHelper::CreateForWebContents(web_contents.get());
22 TabHelper* tab_helper = TabHelper::FromWebContents(web_contents.get());
23 tab_helper->SetExtensionApp(extension);
24 EXPECT_EQ(extension, tab_helper->extension_app());
25 EXPECT_TRUE(tab_helper->is_app());
26 service()->UnloadExtension(extension->id(),
27 UnloadedExtensionInfo::REASON_UNDEFINED);
28 base::RunLoop().RunUntilIdle();
29 EXPECT_EQ(nullptr, tab_helper->extension_app());
30 }
31
32 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698