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

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

Issue 11246003: Remove Profile->GetExtensionProcessManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix extension_crash_recovery_browsertest Created 8 years, 2 months 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 | Annotate | Revision Log
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/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
11 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/extensions/extension_test_message_listener.h" 12 #include "chrome/browser/extensions/extension_test_message_listener.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_finder.h" 14 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 16 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/panels/panel_manager.h" 17 #include "chrome/browser/ui/panels/panel_manager.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
19 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Two popups - one in extension domain and one in non-extension domain. 320 // Two popups - one in extension domain and one in non-extension domain.
320 // Two panels - one in extension domain and one in non-extension domain. 321 // Two panels - one in extension domain and one in non-extension domain.
321 WaitForTabsAndPopups(browser(), 2, num_popups, num_panels); 322 WaitForTabsAndPopups(browser(), 2, num_popups, num_panels);
322 323
323 // Wait on test messages to make sure the pages loaded. 324 // Wait on test messages to make sure the pages loaded.
324 for (size_t i = 0; i < listeners.size(); ++i) 325 for (size_t i = 0; i < listeners.size(); ++i)
325 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied()); 326 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied());
326 327
327 // Crash the extension. 328 // Crash the extension.
328 extensions::ExtensionHost* extension_host = 329 extensions::ExtensionHost* extension_host =
329 browser()->profile()->GetExtensionProcessManager()-> 330 extensions::ExtensionSystem::Get(browser()->profile())->
330 GetBackgroundHostForExtension(extension->id()); 331 process_manager()->GetBackgroundHostForExtension(extension->id());
331 ASSERT_TRUE(extension_host); 332 ASSERT_TRUE(extension_host);
332 base::KillProcess(extension_host->render_process_host()->GetHandle(), 333 base::KillProcess(extension_host->render_process_host()->GetHandle(),
333 content::RESULT_CODE_KILLED, false); 334 content::RESULT_CODE_KILLED, false);
334 WaitForExtensionCrash(extension->id()); 335 WaitForExtensionCrash(extension->id());
335 336
336 // Only expect panels to close. The rest stay open to show a sad-tab. 337 // Only expect panels to close. The rest stay open to show a sad-tab.
337 WaitForTabsAndPopups(browser(), 2, num_popups, 0); 338 WaitForTabsAndPopups(browser(), 2, num_popups, 0);
338 } 339 }
339 340
340 #if defined(USE_ASH) 341 #if defined(USE_ASH)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), 410 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()),
410 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + 411 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ +
411 "/newtab.html"), false, &newtab)); 412 "/newtab.html"), false, &newtab));
412 413
413 // Extension API should succeed. 414 // Extension API should succeed.
414 bool result = false; 415 bool result = false;
415 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 416 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
416 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); 417 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result));
417 EXPECT_TRUE(result); 418 EXPECT_TRUE(result);
418 } 419 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/process_management_browsertest.cc ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698