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

Side by Side Diff: chrome/browser/extensions/chrome_theme_url_browsertest.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/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "extensions/test/extension_test_message_listener.h" 7 #include "extensions/test/extension_test_message_listener.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 // Tests that chrome://theme/ URLs are only accessible to component extensions. 11 // Tests that chrome://theme/ URLs are only accessible to component extensions.
12 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, 12 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest,
13 OnlyComponentExtensionsCanAccessChromeThemeUrls) { 13 OnlyComponentExtensionsCanAccessChromeThemeUrls) {
14 const base::FilePath extension_path( 14 const base::FilePath extension_path(
15 test_data_dir_.AppendASCII("browsertest") 15 test_data_dir_.AppendASCII("browsertest")
16 .AppendASCII("chrome_theme_url")); 16 .AppendASCII("chrome_theme_url"));
17 ExtensionTestMessageListener listener(false); 17 ExtensionTestMessageListener listener(false);
18 18
19 // First try loading the extension as a non-component extension. The 19 // First try loading the extension as a non-component extension. The
20 // chrome://theme/ image referenced in the extension should fail to load. 20 // chrome://theme/ image referenced in the extension should fail to load.
21 const Extension* extension = LoadExtension(extension_path); 21 const Extension* extension = LoadExtension(extension_path);
22 ASSERT_TRUE(extension); 22 ASSERT_TRUE(extension);
23 EXPECT_TRUE(listener.WaitUntilSatisfied()); 23 EXPECT_TRUE(listener.WaitUntilSatisfied());
24 EXPECT_EQ("not loaded", listener.message()); 24 EXPECT_EQ("not loaded", listener.message());
25 25
26 // Unload the extension so we can reload it below with no chance of side 26 // Unload the extension so we can reload it below with no chance of side
27 // effects. 27 // effects.
28 extension_service()->UnloadExtension(extension->id(), 28 extension_service()->UnloadExtension(extension->id(),
29 UnloadedExtensionInfo::REASON_UNINSTALL); 29 UnloadedExtensionReason::UNINSTALL);
30 listener.Reset(); 30 listener.Reset();
31 31
32 // Now try loading the extension as a component extension. This time the 32 // Now try loading the extension as a component extension. This time the
33 // referenced image should load successfully. 33 // referenced image should load successfully.
34 ASSERT_TRUE(LoadExtensionAsComponent(extension_path)); 34 ASSERT_TRUE(LoadExtensionAsComponent(extension_path));
35 EXPECT_TRUE(listener.WaitUntilSatisfied()); 35 EXPECT_TRUE(listener.WaitUntilSatisfied());
36 EXPECT_EQ("loaded", listener.message()); 36 EXPECT_EQ("loaded", listener.message());
37 } 37 }
38 38
39 } // namespace extensions 39 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698