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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "chrome/browser/extensions/browser_action_test_util.h" | 14 #include "chrome/browser/extensions/browser_action_test_util.h" |
14 #include "chrome/browser/extensions/extension_browsertest.h" | 15 #include "chrome/browser/extensions/extension_browsertest.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/test_extension_dir.h" | 17 #include "chrome/browser/extensions/test_extension_dir.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 "<iframe id='frame2' src='empty.html'></iframe>"); | 127 "<iframe id='frame2' src='empty.html'></iframe>"); |
127 | 128 |
128 dir->WriteFile(FILE_PATH_LITERAL("sandboxed.html"), "Some sandboxed page"); | 129 dir->WriteFile(FILE_PATH_LITERAL("sandboxed.html"), "Some sandboxed page"); |
129 | 130 |
130 dir->WriteFile(FILE_PATH_LITERAL("empty.html"), ""); | 131 dir->WriteFile(FILE_PATH_LITERAL("empty.html"), ""); |
131 | 132 |
132 dir->WriteManifest(manifest.ToJSON()); | 133 dir->WriteManifest(manifest.ToJSON()); |
133 | 134 |
134 const Extension* extension = LoadExtension(dir->unpacked_path()); | 135 const Extension* extension = LoadExtension(dir->unpacked_path()); |
135 EXPECT_TRUE(extension); | 136 EXPECT_TRUE(extension); |
136 temp_dirs_.push_back(dir.Pass()); | 137 temp_dirs_.push_back(std::move(dir)); |
137 return extension; | 138 return extension; |
138 } | 139 } |
139 | 140 |
140 // ui_test_utils::NavigateToURL sometimes returns too early: It returns as | 141 // ui_test_utils::NavigateToURL sometimes returns too early: It returns as |
141 // soon as the StopLoading notification has been triggered. This does not | 142 // soon as the StopLoading notification has been triggered. This does not |
142 // imply that RenderFrameDeleted was called, so the test may continue too | 143 // imply that RenderFrameDeleted was called, so the test may continue too |
143 // early and fail when ProcessManager::GetAllFrames() returns too many frames | 144 // early and fail when ProcessManager::GetAllFrames() returns too many frames |
144 // (namely frames that are in the process of being deleted). To work around | 145 // (namely frames that are in the process of being deleted). To work around |
145 // this problem, we also wait until all previous frames have been deleted. | 146 // this problem, we also wait until all previous frames have been deleted. |
146 void NavigateToURL(const GURL& url) { | 147 void NavigateToURL(const GURL& url) { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 pm->OnNetworkRequestDone(frame_host, 1); | 520 pm->OnNetworkRequestDone(frame_host, 1); |
520 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 521 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
521 | 522 |
522 // Simulate only a request completion for this ID and ensure it doesn't result | 523 // Simulate only a request completion for this ID and ensure it doesn't result |
523 // in keepalive decrement. | 524 // in keepalive decrement. |
524 pm->OnNetworkRequestDone(frame_host, 2); | 525 pm->OnNetworkRequestDone(frame_host, 2); |
525 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 526 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
526 } | 527 } |
527 | 528 |
528 } // namespace extensions | 529 } // namespace extensions |
OLD | NEW |