OLD | NEW |
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_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/chrome_version_info.h" | 36 #include "chrome/common/chrome_version_info.h" |
37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
38 #include "content/public/browser/navigation_controller.h" | 38 #include "content/public/browser/navigation_controller.h" |
39 #include "content/public/browser/navigation_entry.h" | 39 #include "content/public/browser/navigation_entry.h" |
40 #include "content/public/browser/notification_registrar.h" | 40 #include "content/public/browser/notification_registrar.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/render_view_host.h" | 42 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/test/browser_test_utils.h" | 43 #include "content/public/test/browser_test_utils.h" |
| 44 #include "extensions/browser/extension_prefs.h" |
44 #include "extensions/browser/extension_system.h" | 45 #include "extensions/browser/extension_system.h" |
45 #include "extensions/common/constants.h" | 46 #include "extensions/common/constants.h" |
46 #include "extensions/common/extension_set.h" | 47 #include "extensions/common/extension_set.h" |
47 #include "sync/api/string_ordinal.h" | 48 #include "sync/api/string_ordinal.h" |
48 | 49 |
49 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
50 #include "chromeos/chromeos_switches.h" | 51 #include "chromeos/chromeos_switches.h" |
51 #endif | 52 #endif |
52 | 53 |
53 using extensions::Extension; | 54 using extensions::Extension; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 EXPECT_TRUE(extension->install_warnings().empty()) << | 164 EXPECT_TRUE(extension->install_warnings().empty()) << |
164 install_warnings_message; | 165 install_warnings_message; |
165 return NULL; | 166 return NULL; |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 const std::string extension_id = extension->id(); | 170 const std::string extension_id = extension->id(); |
170 | 171 |
171 // The call to OnExtensionInstalled ensures the other extension prefs | 172 // The call to OnExtensionInstalled ensures the other extension prefs |
172 // are set up with the defaults. | 173 // are set up with the defaults. |
173 service->extension_prefs()->OnExtensionInstalled( | 174 extensions::ExtensionPrefs::Get(profile()) |
174 extension, | 175 ->OnExtensionInstalled(extension, |
175 Extension::ENABLED, | 176 Extension::ENABLED, |
176 false, | 177 false, |
177 syncer::StringOrdinal::CreateInitialOrdinal()); | 178 syncer::StringOrdinal::CreateInitialOrdinal()); |
178 | 179 |
179 // Toggling incognito or file access will reload the extension, so wait for | 180 // Toggling incognito or file access will reload the extension, so wait for |
180 // the reload and grab the new extension instance. The default state is | 181 // the reload and grab the new extension instance. The default state is |
181 // incognito disabled and file access enabled, so we don't wait in those | 182 // incognito disabled and file access enabled, so we don't wait in those |
182 // cases. | 183 // cases. |
183 { | 184 { |
184 content::WindowedNotificationObserver load_signal( | 185 content::WindowedNotificationObserver load_signal( |
185 chrome::NOTIFICATION_EXTENSION_LOADED, | 186 chrome::NOTIFICATION_EXTENSION_LOADED, |
186 content::Source<Profile>(profile())); | 187 content::Source<Profile>(profile())); |
187 CHECK(!extensions::util::IsIncognitoEnabled(extension_id, profile()) || | 188 CHECK(!extensions::util::IsIncognitoEnabled(extension_id, profile()) || |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 EXPECT_EQ(expected_hosts, num_hosts); | 590 EXPECT_EQ(expected_hosts, num_hosts); |
590 return host; | 591 return host; |
591 } | 592 } |
592 | 593 |
593 std::string ExtensionBrowserTest::ExecuteScriptInBackgroundPage( | 594 std::string ExtensionBrowserTest::ExecuteScriptInBackgroundPage( |
594 const std::string& extension_id, | 595 const std::string& extension_id, |
595 const std::string& script) { | 596 const std::string& script) { |
596 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( | 597 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( |
597 profile(), extension_id, script); | 598 profile(), extension_id, script); |
598 } | 599 } |
OLD | NEW |