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

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

Issue 10113005: Remove EPM:all_hosts_ and use all_extension_views_ instead. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleanup Created 8 years, 8 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 NEW_WINDOW); 75 NEW_WINDOW);
76 76
77 app_loaded_observer.Wait(); 77 app_loaded_observer.Wait();
78 78
79 // Now we have a new platform app running. 79 // Now we have a new platform app running.
80 EXPECT_EQ(platform_app_count + 1, GetPlatformAppCount()); 80 EXPECT_EQ(platform_app_count + 1, GetPlatformAppCount());
81 } 81 }
82 82
83 // Gets the number of platform apps that are running. 83 // Gets the number of platform apps that are running.
84 size_t GetPlatformAppCount() { 84 size_t GetPlatformAppCount() {
85 int count = 0;
86 ExtensionProcessManager* process_manager = 85 ExtensionProcessManager* process_manager =
87 browser()->profile()->GetExtensionProcessManager(); 86 browser()->profile()->GetExtensionProcessManager();
88 ExtensionProcessManager::const_iterator iter; 87 return process_manager->platform_app_hosts().size();
89 for (iter = process_manager->begin(); iter != process_manager->end();
90 ++iter) {
91 ExtensionHost* host = *iter;
92 if (host->extension() && host->extension()->is_platform_app())
93 count++;
94 }
95
96 return count;
97 } 88 }
98 89
99 // Gets the WebContents associated with the ExtensionHost of the first 90 // Gets the WebContents associated with the ExtensionHost of the first
100 // platform app that is found (most tests only deal with one platform 91 // platform app that is found (most tests only deal with one platform
101 // app, so this is good enough). 92 // app, so this is good enough).
102 WebContents* GetFirstPlatformAppWebContents() { 93 WebContents* GetFirstPlatformAppWebContents() {
103 ExtensionProcessManager* process_manager = 94 ExtensionProcessManager* process_manager =
104 browser()->profile()->GetExtensionProcessManager(); 95 browser()->profile()->GetExtensionProcessManager();
105 ExtensionProcessManager::const_iterator iter; 96 ExtensionProcessManager::const_iterator iter;
106 for (iter = process_manager->begin(); iter != process_manager->end(); 97 ExtensionProcessManager::ExtensionHostSet platform_app_hosts =
98 process_manager->platform_app_hosts();
99 for (iter = platform_app_hosts.begin(); iter != platform_app_hosts.end();
107 ++iter) { 100 ++iter) {
108 ExtensionHost* host = *iter; 101 return (*iter)->host_contents();
109 if (host->extension() && host->extension()->is_platform_app())
110 return host->host_contents();
111 } 102 }
112 103
113 return NULL; 104 return NULL;
114 } 105 }
115 }; 106 };
116 107
117 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenAppInShellContainer) { 108 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenAppInShellContainer) {
118 ASSERT_EQ(0u, GetPlatformAppCount()); 109 ASSERT_EQ(0u, GetPlatformAppCount());
119 LoadAndLaunchPlatformApp("empty"); 110 LoadAndLaunchPlatformApp("empty");
120 ASSERT_EQ(1u, GetPlatformAppCount()); 111 ASSERT_EQ(1u, GetPlatformAppCount());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #if defined(USE_AURA) 180 #if defined(USE_AURA)
190 // On Aura, this currently fails because the window width is returned as 256 181 // On Aura, this currently fails because the window width is returned as 256
191 // instead of 250. See http://crbug.com/119410. 182 // instead of 250. See http://crbug.com/119410.
192 #define MAYBE_WindowsApi FAILS_WindowsApi 183 #define MAYBE_WindowsApi FAILS_WindowsApi
193 #else 184 #else
194 #define MAYBE_WindowsApi WindowsApi 185 #define MAYBE_WindowsApi WindowsApi
195 #endif 186 #endif
196 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WindowsApi) { 187 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WindowsApi) {
197 ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_; 188 ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_;
198 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698