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 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 scoped_ptr<TestExtensionDir> dir(new TestExtensionDir()); | 98 scoped_ptr<TestExtensionDir> dir(new TestExtensionDir()); |
99 | 99 |
100 DictionaryBuilder manifest; | 100 DictionaryBuilder manifest; |
101 manifest.Set("name", name) | 101 manifest.Set("name", name) |
102 .Set("version", "1") | 102 .Set("version", "1") |
103 .Set("manifest_version", 2) | 103 .Set("manifest_version", 2) |
104 // To allow ExecuteScript* to work. | 104 // To allow ExecuteScript* to work. |
105 .Set("content_security_policy", | 105 .Set("content_security_policy", |
106 "script-src 'self' 'unsafe-eval'; object-src 'self'") | 106 "script-src 'self' 'unsafe-eval'; object-src 'self'") |
107 .Set("sandbox", | 107 .Set("sandbox", |
108 std::move(DictionaryBuilder().Set( | 108 DictionaryBuilder() |
109 "pages", std::move(ListBuilder().Append("sandboxed.html"))))) | 109 .Set("pages", ListBuilder().Append("sandboxed.html").Build()) |
110 .Set("web_accessible_resources", std::move(ListBuilder().Append("*"))); | 110 .Build()) |
| 111 .Set("web_accessible_resources", ListBuilder().Append("*").Build()); |
111 | 112 |
112 if (has_background_process) { | 113 if (has_background_process) { |
113 manifest.Set("background", | 114 manifest.Set("background", |
114 std::move(DictionaryBuilder().Set("page", "bg.html"))); | 115 DictionaryBuilder().Set("page", "bg.html").Build()); |
115 dir->WriteFile(FILE_PATH_LITERAL("bg.html"), | 116 dir->WriteFile(FILE_PATH_LITERAL("bg.html"), |
116 "<iframe id='bgframe' src='empty.html'></iframe>"); | 117 "<iframe id='bgframe' src='empty.html'></iframe>"); |
117 } | 118 } |
118 | 119 |
119 dir->WriteFile(FILE_PATH_LITERAL("blank_iframe.html"), | 120 dir->WriteFile(FILE_PATH_LITERAL("blank_iframe.html"), |
120 "<iframe id='frame0' src='about:blank'></iframe>"); | 121 "<iframe id='frame0' src='about:blank'></iframe>"); |
121 | 122 |
122 dir->WriteFile(FILE_PATH_LITERAL("srcdoc_iframe.html"), | 123 dir->WriteFile(FILE_PATH_LITERAL("srcdoc_iframe.html"), |
123 "<iframe id='frame0' srcdoc='Hello world'></iframe>"); | 124 "<iframe id='frame0' srcdoc='Hello world'></iframe>"); |
124 | 125 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 pm->OnNetworkRequestDone(frame_host, 1); | 521 pm->OnNetworkRequestDone(frame_host, 1); |
521 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 522 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
522 | 523 |
523 // Simulate only a request completion for this ID and ensure it doesn't result | 524 // Simulate only a request completion for this ID and ensure it doesn't result |
524 // in keepalive decrement. | 525 // in keepalive decrement. |
525 pm->OnNetworkRequestDone(frame_host, 2); | 526 pm->OnNetworkRequestDone(frame_host, 2); |
526 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); | 527 EXPECT_EQ(baseline_keepalive, pm->GetLazyKeepaliveCount(extension.get())); |
527 } | 528 } |
528 | 529 |
529 } // namespace extensions | 530 } // namespace extensions |
OLD | NEW |