Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: chrome/browser/extensions/process_manager_browsertest.cc

Issue 2446903003: Properly initialize GuestViewManager.factory in ProcessManagerBrowserTest. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::set<content::RenderFrameHost*> frames_; 166 std::set<content::RenderFrameHost*> frames_;
167 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 167 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
168 168
169 DISALLOW_COPY_AND_ASSIGN(NavigationCompletedObserver); 169 DISALLOW_COPY_AND_ASSIGN(NavigationCompletedObserver);
170 }; 170 };
171 171
172 // Exists as a browser test because ExtensionHosts are hard to create without 172 // Exists as a browser test because ExtensionHosts are hard to create without
173 // a real browser. 173 // a real browser.
174 class ProcessManagerBrowserTest : public ExtensionBrowserTest { 174 class ProcessManagerBrowserTest : public ExtensionBrowserTest {
175 public: 175 public:
176 ProcessManagerBrowserTest() {
177 guest_view::GuestViewManager::set_factory_for_testing(&factory_);
178 }
176 // Create an extension with web-accessible frames and an optional background 179 // Create an extension with web-accessible frames and an optional background
177 // page. 180 // page.
178 const Extension* CreateExtension(const std::string& name, 181 const Extension* CreateExtension(const std::string& name,
179 bool has_background_process) { 182 bool has_background_process) {
180 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir()); 183 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir());
181 184
182 DictionaryBuilder manifest; 185 DictionaryBuilder manifest;
183 manifest.Set("name", name) 186 manifest.Set("name", name)
184 .Set("version", "1") 187 .Set("version", "1")
185 .Set("manifest_version", 2) 188 .Set("manifest_version", 2)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 EXPECT_TRUE(ExecuteScript(opener, "window.open('" + url.spec() + "')")); 256 EXPECT_TRUE(ExecuteScript(opener, "window.open('" + url.spec() + "')"));
254 popup_observer.Wait(); 257 popup_observer.Wait();
255 content::WebContents* popup = 258 content::WebContents* popup =
256 browser()->tab_strip_model()->GetActiveWebContents(); 259 browser()->tab_strip_model()->GetActiveWebContents();
257 WaitForLoadStop(popup); 260 WaitForLoadStop(popup);
258 EXPECT_EQ(url, popup->GetMainFrame()->GetLastCommittedURL()); 261 EXPECT_EQ(url, popup->GetMainFrame()->GetLastCommittedURL());
259 return popup; 262 return popup;
260 } 263 }
261 264
262 private: 265 private:
266 guest_view::TestGuestViewManagerFactory factory_;
263 std::vector<std::unique_ptr<TestExtensionDir>> temp_dirs_; 267 std::vector<std::unique_ptr<TestExtensionDir>> temp_dirs_;
264 }; 268 };
265 269
266 // Test that basic extension loading creates the appropriate ExtensionHosts 270 // Test that basic extension loading creates the appropriate ExtensionHosts
267 // and background pages. 271 // and background pages.
268 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, 272 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest,
269 ExtensionHostCreation) { 273 ExtensionHostCreation) {
270 ProcessManager* pm = ProcessManager::Get(profile()); 274 ProcessManager* pm = ProcessManager::Get(profile());
271 275
272 // We start with no background hosts. 276 // We start with no background hosts.
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 EXPECT_TRUE(ExecuteScriptAndExtractBool( 1061 EXPECT_TRUE(ExecuteScriptAndExtractBool(
1058 popup, "window.domAutomationController.send(!!window.opener)", 1062 popup, "window.domAutomationController.send(!!window.opener)",
1059 &is_opener_defined)); 1063 &is_opener_defined));
1060 EXPECT_TRUE(is_opener_defined); 1064 EXPECT_TRUE(is_opener_defined);
1061 1065
1062 // Verify that postMessage to window.opener works. 1066 // Verify that postMessage to window.opener works.
1063 VerifyPostMessageToOpener(popup->GetMainFrame(), extension_frame); 1067 VerifyPostMessageToOpener(popup->GetMainFrame(), extension_frame);
1064 } 1068 }
1065 1069
1066 } // namespace extensions 1070 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698