OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file contains tests for extension loading, reloading, and | 5 // This file contains tests for extension loading, reloading, and |
6 // unloading behavior. | 6 // unloading behavior. |
7 | 7 |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
| 11 #include "base/win/windows_version.h" |
11 #include "chrome/browser/extensions/devtools_util.h" | 12 #include "chrome/browser/extensions/devtools_util.h" |
12 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/test_extension_dir.h" | 15 #include "chrome/browser/extensions/test_extension_dir.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/browser/devtools_agent_host.h" | 20 #include "content/public/browser/devtools_agent_host.h" |
20 #include "extensions/browser/extension_registry.h" | 21 #include "extensions/browser/extension_registry.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 91 |
91 // Check that the extension hasn't crashed. | 92 // Check that the extension hasn't crashed. |
92 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 93 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
93 EXPECT_EQ(0U, registry->terminated_extensions().size()); | 94 EXPECT_EQ(0U, registry->terminated_extensions().size()); |
94 EXPECT_TRUE(registry->enabled_extensions().Contains(new_tab_extension->id())); | 95 EXPECT_TRUE(registry->enabled_extensions().Contains(new_tab_extension->id())); |
95 } | 96 } |
96 | 97 |
97 // Tests the behavior described in http://crbug.com/532088. | 98 // Tests the behavior described in http://crbug.com/532088. |
98 IN_PROC_BROWSER_TEST_F(ExtensionLoadingTest, | 99 IN_PROC_BROWSER_TEST_F(ExtensionLoadingTest, |
99 KeepAliveWithDevToolsOpenOnReload) { | 100 KeepAliveWithDevToolsOpenOnReload) { |
| 101 #if defined(OS_WIN) |
| 102 // Flaky on Win XP SP3. http://crbug.com/560716. |
| 103 if (base::win::GetVersion() <= base::win::VERSION_SERVER_2003) |
| 104 return; |
| 105 #endif |
| 106 |
100 embedded_test_server()->ServeFilesFromDirectory( | 107 embedded_test_server()->ServeFilesFromDirectory( |
101 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 108 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
102 ASSERT_TRUE(embedded_test_server()->Start()); | 109 ASSERT_TRUE(embedded_test_server()->Start()); |
103 | 110 |
104 TestExtensionDir extension_dir; | 111 TestExtensionDir extension_dir; |
105 const char manifest_contents[] = | 112 const char manifest_contents[] = |
106 "{" | 113 "{" |
107 " 'name': 'Test With Lazy Background Page'," | 114 " 'name': 'Test With Lazy Background Page'," |
108 " 'version': '0'," | 115 " 'version': '0'," |
109 " 'manifest_version': 2," | 116 " 'manifest_version': 2," |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // The old Extension object is no longer valid. | 156 // The old Extension object is no longer valid. |
150 extension = ExtensionRegistry::Get(profile()) | 157 extension = ExtensionRegistry::Get(profile()) |
151 ->enabled_extensions().GetByID(extension_id); | 158 ->enabled_extensions().GetByID(extension_id); |
152 | 159 |
153 // Keepalive count should stabilize back to 1, because DevTools is still open. | 160 // Keepalive count should stabilize back to 1, because DevTools is still open. |
154 EXPECT_EQ(1, process_manager->GetLazyKeepaliveCount(extension)); | 161 EXPECT_EQ(1, process_manager->GetLazyKeepaliveCount(extension)); |
155 } | 162 } |
156 | 163 |
157 } // namespace | 164 } // namespace |
158 } // namespace extensions | 165 } // namespace extensions |
OLD | NEW |