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

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

Issue 283113002: s/precendence/precedence/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_web_ui.h" 8 #include "chrome/browser/extensions/extension_web_ui.h"
9 #include "chrome/browser/extensions/test_extension_system.h" 9 #include "chrome/browser/extensions/test_extension_system.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 extensions::DictionaryBuilder().Set("bookmarks", "2.html")); 84 extensions::DictionaryBuilder().Set("bookmarks", "2.html"));
85 scoped_refptr<Extension> ext_component( 85 scoped_refptr<Extension> ext_component(
86 extensions::ExtensionBuilder() 86 extensions::ExtensionBuilder()
87 .SetManifest(manifest2) 87 .SetManifest(manifest2)
88 .SetLocation(Manifest::COMPONENT) 88 .SetLocation(Manifest::COMPONENT)
89 .SetID("bbabcdefghijabcdefghijabcdefghij") 89 .SetID("bbabcdefghijabcdefghijabcdefghij")
90 .Build()); 90 .Build());
91 profile_->GetExtensionService()->AddComponentExtension(ext_component.get()); 91 profile_->GetExtensionService()->AddComponentExtension(ext_component.get());
92 92
93 // Despite being registered more recently, the component extension should 93 // Despite being registered more recently, the component extension should
94 // not take precendence over the non-component extension. 94 // not take precedence over the non-component extension.
95 url = GURL("chrome://bookmarks"); 95 url = GURL("chrome://bookmarks");
96 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get())); 96 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get()));
97 EXPECT_EQ(url, expected_unpacked_override_url); 97 EXPECT_EQ(url, expected_unpacked_override_url);
98 98
99 GURL expected_component_override_url( 99 GURL expected_component_override_url(
100 std::string(ext_component->url().spec()) + "2.html"); 100 std::string(ext_component->url().spec()) + "2.html");
101 101
102 // Unregister non-component extension. Only component extension remaining. 102 // Unregister non-component extension. Only component extension remaining.
103 ExtensionWebUI::UnregisterChromeURLOverrides( 103 ExtensionWebUI::UnregisterChromeURLOverrides(
104 profile_.get(), URLOverrides::GetChromeURLOverrides(ext_unpacked.get())); 104 profile_.get(), URLOverrides::GetChromeURLOverrides(ext_unpacked.get()));
105 url = GURL("chrome://bookmarks"); 105 url = GURL("chrome://bookmarks");
106 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get())); 106 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get()));
107 EXPECT_EQ(url, expected_component_override_url); 107 EXPECT_EQ(url, expected_component_override_url);
108 108
109 // This time the non-component extension was registered more recently and 109 // This time the non-component extension was registered more recently and
110 // should still take precedence. 110 // should still take precedence.
111 ExtensionWebUI::RegisterChromeURLOverrides( 111 ExtensionWebUI::RegisterChromeURLOverrides(
112 profile_.get(), URLOverrides::GetChromeURLOverrides(ext_unpacked.get())); 112 profile_.get(), URLOverrides::GetChromeURLOverrides(ext_unpacked.get()));
113 url = GURL("chrome://bookmarks"); 113 url = GURL("chrome://bookmarks");
114 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get())); 114 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverride(&url, profile_.get()));
115 EXPECT_EQ(url, expected_unpacked_override_url); 115 EXPECT_EQ(url, expected_unpacked_override_url);
116 } 116 }
117 117
118 } // namespace extensions 118 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_target_determiner_unittest.cc ('k') | chrome/browser/ui/cocoa/hyperlink_text_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698