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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_web_ui.h" 7 #include "chrome/browser/extensions/extension_web_ui.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/prefs/scoped_user_pref_update.h" 9 #include "chrome/browser/prefs/scoped_user_pref_update.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ResultCatcher catcher; 110 ResultCatcher catcher;
111 // Navigate to the history page. The overridden history page 111 // Navigate to the history page. The overridden history page
112 // will call chrome.test.notifyPass() . 112 // will call chrome.test.notifyPass() .
113 ui_test_utils::NavigateToURL(browser(), GURL("chrome://history/")); 113 ui_test_utils::NavigateToURL(browser(), GURL("chrome://history/"));
114 ASSERT_TRUE(catcher.GetNextResult()); 114 ASSERT_TRUE(catcher.GetNextResult());
115 } 115 }
116 } 116 }
117 117
118 // Regression test for http://crbug.com/41442. 118 // Regression test for http://crbug.com/41442.
119 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldNotCreateDuplicateEntries) { 119 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldNotCreateDuplicateEntries) {
120 const Extension* extension = 120 const extensions::Extension* extension =
121 LoadExtension(test_data_dir_.AppendASCII("override/history")); 121 LoadExtension(test_data_dir_.AppendASCII("override/history"));
122 ASSERT_TRUE(extension); 122 ASSERT_TRUE(extension);
123 123
124 // Simulate several LoadExtension() calls happening over the lifetime of 124 // Simulate several LoadExtension() calls happening over the lifetime of
125 // a preferences file without corresponding UnloadExtension() calls. 125 // a preferences file without corresponding UnloadExtension() calls.
126 for (size_t i = 0; i < 3; ++i) { 126 for (size_t i = 0; i < 3; ++i) {
127 ExtensionWebUI::RegisterChromeURLOverrides( 127 ExtensionWebUI::RegisterChromeURLOverrides(
128 browser()->profile(), 128 browser()->profile(),
129 extension->GetChromeURLOverrides()); 129 extension->GetChromeURLOverrides());
130 } 130 }
(...skipping 26 matching lines...) Expand all
157 #if defined(USE_VIRTUAL_KEYBOARD) 157 #if defined(USE_VIRTUAL_KEYBOARD)
158 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideKeyboard) { 158 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideKeyboard) {
159 ASSERT_TRUE(RunExtensionTest("override/keyboard")) << message_; 159 ASSERT_TRUE(RunExtensionTest("override/keyboard")) << message_;
160 { 160 {
161 ResultCatcher catcher; 161 ResultCatcher catcher;
162 NavigateToKeyboard(); 162 NavigateToKeyboard();
163 ASSERT_TRUE(catcher.GetNextResult()); 163 ASSERT_TRUE(catcher.GetNextResult());
164 } 164 }
165 165
166 // Load the failing version. This should take precedence. 166 // Load the failing version. This should take precedence.
167 const Extension* extension = LoadExtension( 167 const extensions::Extension* extension = LoadExtension(
168 test_data_dir_.AppendASCII("override").AppendASCII("keyboard_fails")); 168 test_data_dir_.AppendASCII("override").AppendASCII("keyboard_fails"));
169 ASSERT_TRUE(extension); 169 ASSERT_TRUE(extension);
170 { 170 {
171 ResultCatcher catcher; 171 ResultCatcher catcher;
172 NavigateToKeyboard(); 172 NavigateToKeyboard();
173 ASSERT_FALSE(catcher.GetNextResult()); 173 ASSERT_FALSE(catcher.GetNextResult());
174 } 174 }
175 175
176 // Unload the failing version. We should be back to passing now. 176 // Unload the failing version. We should be back to passing now.
177 UnloadExtension(extension->id()); 177 UnloadExtension(extension->id());
178 { 178 {
179 ResultCatcher catcher; 179 ResultCatcher catcher;
180 NavigateToKeyboard(); 180 NavigateToKeyboard();
181 ASSERT_TRUE(catcher.GetNextResult()); 181 ASSERT_TRUE(catcher.GetNextResult());
182 } 182 }
183 } 183 }
184 #endif 184 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_navigation_observer.cc ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698