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

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

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 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 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/tab_helper.h" 5 #include "chrome/browser/extensions/tab_helper.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_service_test_with_install.h" 8 #include "chrome/browser/extensions/extension_service_test_with_install.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/test/web_contents_tester.h" 10 #include "content/public/test/web_contents_tester.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 TEST_F(ExtensionServiceTestWithInstall, TabHelperClearsExtensionOnUnload) { 14 TEST_F(ExtensionServiceTestWithInstall, TabHelperClearsExtensionOnUnload) {
15 InitializeEmptyExtensionService(); 15 InitializeEmptyExtensionService();
16 const Extension* extension = 16 const Extension* extension =
17 PackAndInstallCRX(data_dir().AppendASCII("hosted_app"), INSTALL_NEW); 17 PackAndInstallCRX(data_dir().AppendASCII("hosted_app"), INSTALL_NEW);
18 ASSERT_TRUE(extension); 18 ASSERT_TRUE(extension);
19 std::unique_ptr<content::WebContents> web_contents( 19 std::unique_ptr<content::WebContents> web_contents(
20 content::WebContentsTester::CreateTestWebContents(profile(), nullptr)); 20 content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
21 TabHelper::CreateForWebContents(web_contents.get()); 21 TabHelper::CreateForWebContents(web_contents.get());
22 TabHelper* tab_helper = TabHelper::FromWebContents(web_contents.get()); 22 TabHelper* tab_helper = TabHelper::FromWebContents(web_contents.get());
23 tab_helper->SetExtensionApp(extension); 23 tab_helper->SetExtensionApp(extension);
24 EXPECT_EQ(extension, tab_helper->extension_app()); 24 EXPECT_EQ(extension, tab_helper->extension_app());
25 EXPECT_TRUE(tab_helper->is_app()); 25 EXPECT_TRUE(tab_helper->is_app());
26 service()->UnloadExtension(extension->id(), 26 service()->UnloadExtension(extension->id(),
27 UnloadedExtensionInfo::REASON_UNDEFINED); 27 UnloadedExtensionReason::REASON_UNDEFINED);
28 base::RunLoop().RunUntilIdle(); 28 base::RunLoop().RunUntilIdle();
29 EXPECT_EQ(nullptr, tab_helper->extension_app()); 29 EXPECT_EQ(nullptr, tab_helper->extension_app());
30 } 30 }
31 31
32 } // namespace extensions 32 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698