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

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

Issue 671763002: Extract ProcessManager from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/browser_iterator.h" 13 #include "chrome/browser/ui/browser_iterator.h"
14 #include "chrome/browser/ui/panels/panel_manager.h" 14 #include "chrome/browser/ui/panels/panel_manager.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/test_switches.h" 18 #include "chrome/test/base/test_switches.h"
19 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/result_codes.h" 22 #include "content/public/common/result_codes.h"
23 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
24 #include "content/public/test/browser_test_utils.h" 24 #include "content/public/test/browser_test_utils.h"
25 #include "extensions/browser/extension_host.h" 25 #include "extensions/browser/extension_host.h"
26 #include "extensions/browser/extension_system.h"
27 #include "extensions/browser/process_manager.h" 26 #include "extensions/browser/process_manager.h"
28 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
29 #include "extensions/common/extension.h" 28 #include "extensions/common/extension.h"
30 #include "extensions/common/switches.h" 29 #include "extensions/common/switches.h"
31 #include "extensions/test/extension_test_message_listener.h" 30 #include "extensions/test/extension_test_message_listener.h"
32 #include "extensions/test/result_catcher.h" 31 #include "extensions/test/result_catcher.h"
33 #include "net/dns/mock_host_resolver.h" 32 #include "net/dns/mock_host_resolver.h"
34 #include "net/test/embedded_test_server/embedded_test_server.h" 33 #include "net/test/embedded_test_server/embedded_test_server.h"
35 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
36 35
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // Two popups - one in extension domain and one in non-extension domain. 391 // Two popups - one in extension domain and one in non-extension domain.
393 // Two panels - one in extension domain and one in non-extension domain. 392 // Two panels - one in extension domain and one in non-extension domain.
394 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, num_panels)); 393 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, num_panels));
395 394
396 // Wait on test messages to make sure the pages loaded. 395 // Wait on test messages to make sure the pages loaded.
397 for (size_t i = 0; i < listeners.size(); ++i) 396 for (size_t i = 0; i < listeners.size(); ++i)
398 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied()); 397 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied());
399 398
400 // Crash the extension. 399 // Crash the extension.
401 extensions::ExtensionHost* extension_host = 400 extensions::ExtensionHost* extension_host =
402 extensions::ExtensionSystem::Get(browser()->profile())-> 401 extensions::ProcessManager::Get(browser()->profile())
403 process_manager()->GetBackgroundHostForExtension(extension->id()); 402 ->GetBackgroundHostForExtension(extension->id());
404 ASSERT_TRUE(extension_host); 403 ASSERT_TRUE(extension_host);
405 base::KillProcess(extension_host->render_process_host()->GetHandle(), 404 base::KillProcess(extension_host->render_process_host()->GetHandle(),
406 content::RESULT_CODE_KILLED, false); 405 content::RESULT_CODE_KILLED, false);
407 WaitForExtensionCrash(extension->id()); 406 WaitForExtensionCrash(extension->id());
408 407
409 // Only expect panels to close. The rest stay open to show a sad-tab. 408 // Only expect panels to close. The rest stay open to show a sad-tab.
410 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, 0)); 409 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, 0));
411 } 410 }
412 #endif // !defined(OS_CHROMEOS) 411 #endif // !defined(OS_CHROMEOS)
413 412
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 last_loaded_extension_id() + "/newtab.html"), 503 last_loaded_extension_id() + "/newtab.html"),
505 false, 504 false,
506 &newtab)); 505 &newtab));
507 506
508 // Extension API should succeed. 507 // Extension API should succeed.
509 bool result = false; 508 bool result = false;
510 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 509 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
511 &result)); 510 &result));
512 EXPECT_TRUE(result); 511 EXPECT_TRUE(result);
513 } 512 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_system.cc ('k') | chrome/browser/net/chrome_extensions_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698