| 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 #include "extensions/browser/process_manager.h" | 5 #include "extensions/browser/process_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/browser_action_test_util.h" | 7 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Load an extension with a background page. | 119 // Load an extension with a background page. |
| 120 scoped_refptr<const Extension> extension = | 120 scoped_refptr<const Extension> extension = |
| 121 LoadExtension(test_data_dir_.AppendASCII("api_test") | 121 LoadExtension(test_data_dir_.AppendASCII("api_test") |
| 122 .AppendASCII("browser_action") | 122 .AppendASCII("browser_action") |
| 123 .AppendASCII("none")); | 123 .AppendASCII("none")); |
| 124 | 124 |
| 125 // Set up a test server running at http://[extension-id] | 125 // Set up a test server running at http://[extension-id] |
| 126 ASSERT_TRUE(extension.get()); | 126 ASSERT_TRUE(extension.get()); |
| 127 const std::string& aliased_host = extension->id(); | 127 const std::string& aliased_host = extension->id(); |
| 128 host_resolver()->AddRule(aliased_host, "127.0.0.1"); | 128 host_resolver()->AddRule(aliased_host, "127.0.0.1"); |
| 129 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 129 ASSERT_TRUE(embedded_test_server()->Start()); |
| 130 GURL url = | 130 GURL url = |
| 131 embedded_test_server()->GetURL("/extensions/test_file_with_body.html"); | 131 embedded_test_server()->GetURL("/extensions/test_file_with_body.html"); |
| 132 GURL::Replacements replace_host; | 132 GURL::Replacements replace_host; |
| 133 replace_host.SetHostStr(aliased_host); | 133 replace_host.SetHostStr(aliased_host); |
| 134 url = url.ReplaceComponents(replace_host); | 134 url = url.ReplaceComponents(replace_host); |
| 135 | 135 |
| 136 // Load a page from the test host in a new tab. | 136 // Load a page from the test host in a new tab. |
| 137 ui_test_utils::NavigateToURLWithDisposition( | 137 ui_test_utils::NavigateToURLWithDisposition( |
| 138 browser(), | 138 browser(), |
| 139 url, | 139 url, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 pm->OnNetworkRequestDone(frame_host, 1); | 187 pm->OnNetworkRequestDone(frame_host, 1); |
| 188 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 188 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
| 189 | 189 |
| 190 // Simulate only a request completion for this ID and ensure it doesn't result | 190 // Simulate only a request completion for this ID and ensure it doesn't result |
| 191 // in keepalive decrement. | 191 // in keepalive decrement. |
| 192 pm->OnNetworkRequestDone(frame_host, 2); | 192 pm->OnNetworkRequestDone(frame_host, 2); |
| 193 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 193 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace extensions | 196 } // namespace extensions |
| OLD | NEW |