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

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

Issue 65123002: Move chrome/common/extensions/background_info.h to src/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase2 background_info Created 7 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 | 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 "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.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_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/common/extensions/extension_file_util.h" 22 #include "chrome/common/extensions/extension_file_util.h"
23 #include "chrome/test/base/test_switches.h" 23 #include "chrome/test/base/test_switches.h"
24 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
25 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
31 #include "content/public/test/test_navigation_observer.h" 31 #include "content/public/test/test_navigation_observer.h"
32 #include "extensions/common/switches.h"
32 #include "net/dns/mock_host_resolver.h" 33 #include "net/dns/mock_host_resolver.h"
33 #include "net/test/embedded_test_server/embedded_test_server.h" 34 #include "net/test/embedded_test_server/embedded_test_server.h"
34 #include "sync/api/string_ordinal.h" 35 #include "sync/api/string_ordinal.h"
35 36
36 using content::NavigationController; 37 using content::NavigationController;
37 using content::RenderViewHost; 38 using content::RenderViewHost;
38 using content::WebContents; 39 using content::WebContents;
39 using extensions::Extension; 40 using extensions::Extension;
40 41
41 class AppApiTest : public ExtensionApiTest { 42 class AppApiTest : public ExtensionApiTest {
42 protected: 43 protected:
43 // Gets the base URL for files for a specific test, making sure that it uses 44 // Gets the base URL for files for a specific test, making sure that it uses
44 // "localhost" as the hostname, since that is what the extent is declared 45 // "localhost" as the hostname, since that is what the extent is declared
45 // as in the test apps manifests. 46 // as in the test apps manifests.
46 GURL GetTestBaseURL(std::string test_directory) { 47 GURL GetTestBaseURL(std::string test_directory) {
47 GURL::Replacements replace_host; 48 GURL::Replacements replace_host;
48 std::string host_str("localhost"); // must stay in scope with replace_host 49 std::string host_str("localhost"); // must stay in scope with replace_host
49 replace_host.SetHostStr(host_str); 50 replace_host.SetHostStr(host_str);
50 GURL base_url = embedded_test_server()->GetURL( 51 GURL base_url = embedded_test_server()->GetURL(
51 "/extensions/api_test/" + test_directory + "/"); 52 "/extensions/api_test/" + test_directory + "/");
52 return base_url.ReplaceComponents(replace_host); 53 return base_url.ReplaceComponents(replace_host);
53 } 54 }
54 55
55 // Pass flags to make testing apps easier. 56 // Pass flags to make testing apps easier.
56 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 57 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
57 ExtensionApiTest::SetUpCommandLine(command_line); 58 ExtensionApiTest::SetUpCommandLine(command_line);
58 CommandLine::ForCurrentProcess()->AppendSwitch( 59 CommandLine::ForCurrentProcess()->AppendSwitch(
59 switches::kDisablePopupBlocking); 60 switches::kDisablePopupBlocking);
60 CommandLine::ForCurrentProcess()->AppendSwitch( 61 CommandLine::ForCurrentProcess()->AppendSwitch(
61 switches::kAllowHTTPBackgroundPage); 62 extensions::switches::kAllowHTTPBackgroundPage);
62 } 63 }
63 64
64 // Helper function to test that independent tabs of the named app are loaded 65 // Helper function to test that independent tabs of the named app are loaded
65 // into separate processes. 66 // into separate processes.
66 void TestAppInstancesHelper(std::string app_name) { 67 void TestAppInstancesHelper(std::string app_name) {
67 LOG(INFO) << "Start of test."; 68 LOG(INFO) << "Start of test.";
68 69
69 extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get( 70 extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get(
70 browser()->profile())->extension_service()->process_map(); 71 browser()->profile())->extension_service()->process_map();
71 72
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 UnloadExtension(extension->id()); 127 UnloadExtension(extension->id());
127 } 128 }
128 }; 129 };
129 130
130 // Omits the disable-popup-blocking flag so we can cover that case. 131 // Omits the disable-popup-blocking flag so we can cover that case.
131 class BlockedAppApiTest : public AppApiTest { 132 class BlockedAppApiTest : public AppApiTest {
132 protected: 133 protected:
133 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 134 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
134 ExtensionApiTest::SetUpCommandLine(command_line); 135 ExtensionApiTest::SetUpCommandLine(command_line);
135 CommandLine::ForCurrentProcess()->AppendSwitch( 136 CommandLine::ForCurrentProcess()->AppendSwitch(
136 switches::kAllowHTTPBackgroundPage); 137 extensions::switches::kAllowHTTPBackgroundPage);
137 } 138 }
138 }; 139 };
139 140
140 // Tests that hosted apps with the background permission get a process-per-app 141 // Tests that hosted apps with the background permission get a process-per-app
141 // model, since all pages need to be able to script the background page. 142 // model, since all pages need to be able to script the background page.
142 // http://crbug.com/172750 143 // http://crbug.com/172750
143 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { 144 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) {
144 LOG(INFO) << "Start of test."; 145 LOG(INFO) << "Start of test.";
145 146
146 extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get( 147 extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get(
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 &browser()->tab_strip_model()->GetActiveWebContents()-> 818 &browser()->tab_strip_model()->GetActiveWebContents()->
818 GetController())); 819 GetController()));
819 chrome::Reload(browser(), CURRENT_TAB); 820 chrome::Reload(browser(), CURRENT_TAB);
820 observer.Wait(); 821 observer.Wait();
821 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 822 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
822 contents, 823 contents,
823 "window.domAutomationController.send(chrome.app.isInstalled)", 824 "window.domAutomationController.send(chrome.app.isInstalled)",
824 &is_installed)); 825 &is_installed));
825 ASSERT_TRUE(is_installed); 826 ASSERT_TRUE(is_installed);
826 } 827 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_background_page_apitest.cc ('k') | chrome/browser/extensions/component_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698