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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/automation/automation_util.h" 6 #include "chrome/browser/automation/automation_util.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_process_manager.h" 9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // The app under test acts on URLs whose host is "localhost", 56 // The app under test acts on URLs whose host is "localhost",
57 // so the URLs we navigate to must have host "localhost". 57 // so the URLs we navigate to must have host "localhost".
58 GURL base_url = test_server()->GetURL( 58 GURL base_url = test_server()->GetURL(
59 "files/extensions/"); 59 "files/extensions/");
60 GURL::Replacements replace_host; 60 GURL::Replacements replace_host;
61 std::string host_str("localhost"); // Must stay in scope with replace_host. 61 std::string host_str("localhost"); // Must stay in scope with replace_host.
62 replace_host.SetHostStr(host_str); 62 replace_host.SetHostStr(host_str);
63 base_url = base_url.ReplaceComponents(replace_host); 63 base_url = base_url.ReplaceComponents(replace_host);
64 64
65 // Load an extension before adding tabs. 65 // Load an extension before adding tabs.
66 const Extension* extension1 = LoadExtension( 66 const extensions::Extension* extension1 = LoadExtension(
67 test_data_dir_.AppendASCII("api_test/browser_action/basics")); 67 test_data_dir_.AppendASCII("api_test/browser_action/basics"));
68 ASSERT_TRUE(extension1); 68 ASSERT_TRUE(extension1);
69 GURL extension1_url = extension1->url(); 69 GURL extension1_url = extension1->url();
70 70
71 // Create multiple tabs for each type of renderer that might exist. 71 // Create multiple tabs for each type of renderer that might exist.
72 ui_test_utils::NavigateToURLWithDisposition( 72 ui_test_utils::NavigateToURLWithDisposition(
73 browser(), base_url.Resolve("isolated_apps/app1/main.html"), 73 browser(), base_url.Resolve("isolated_apps/app1/main.html"),
74 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 74 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
75 ui_test_utils::NavigateToURLWithDisposition( 75 ui_test_utils::NavigateToURLWithDisposition(
76 browser(), GURL(chrome::kChromeUINewTabURL), 76 browser(), GURL(chrome::kChromeUINewTabURL),
(...skipping 17 matching lines...) Expand all
94 ui_test_utils::NavigateToURLWithDisposition( 94 ui_test_utils::NavigateToURLWithDisposition(
95 browser(), base_url.Resolve("test_file_with_body.html"), 95 browser(), base_url.Resolve("test_file_with_body.html"),
96 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 96 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
97 97
98 // Load another copy of isolated app 1. 98 // Load another copy of isolated app 1.
99 ui_test_utils::NavigateToURLWithDisposition( 99 ui_test_utils::NavigateToURLWithDisposition(
100 browser(), base_url.Resolve("isolated_apps/app1/main.html"), 100 browser(), base_url.Resolve("isolated_apps/app1/main.html"),
101 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 101 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
102 102
103 // Load another extension. 103 // Load another extension.
104 const Extension* extension2 = LoadExtension( 104 const extensions::Extension* extension2 = LoadExtension(
105 test_data_dir_.AppendASCII("api_test/browser_action/close_background")); 105 test_data_dir_.AppendASCII("api_test/browser_action/close_background"));
106 ASSERT_TRUE(extension2); 106 ASSERT_TRUE(extension2);
107 GURL extension2_url = extension2->url(); 107 GURL extension2_url = extension2->url();
108 108
109 // Get tab processes. 109 // Get tab processes.
110 ASSERT_EQ(9, browser()->tab_count()); 110 ASSERT_EQ(9, browser()->tab_count());
111 content::RenderProcessHost* isolated1_host = 111 content::RenderProcessHost* isolated1_host =
112 browser()->GetWebContentsAt(0)->GetRenderProcessHost(); 112 browser()->GetWebContentsAt(0)->GetRenderProcessHost();
113 content::RenderProcessHost* ntp1_host = 113 content::RenderProcessHost* ntp1_host =
114 browser()->GetWebContentsAt(1)->GetRenderProcessHost(); 114 browser()->GetWebContentsAt(1)->GetRenderProcessHost();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 iter != epm->background_hosts().end(); ++iter) { 220 iter != epm->background_hosts().end(); ++iter) {
221 process_ids.insert((*iter)->render_process_host()->GetID()); 221 process_ids.insert((*iter)->render_process_host()->GetID());
222 } 222 }
223 223
224 // We've loaded 5 extensions with background pages, 1 extension without 224 // We've loaded 5 extensions with background pages, 1 extension without
225 // background page, and one isolated app. We expect only 2 unique processes 225 // background page, and one isolated app. We expect only 2 unique processes
226 // hosting those extensions. 226 // hosting those extensions.
227 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size()); 227 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size());
228 EXPECT_EQ((size_t) 2, process_ids.size()); 228 EXPECT_EQ((size_t) 2, process_ids.size());
229 } 229 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_browsertest.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698