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

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: Make tests work 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 85 int count = 0;
86 ExtensionProcessManager* process_manager = 86 ExtensionProcessManager* process_manager =
87 browser()->profile()->GetExtensionProcessManager(); 87 browser()->profile()->GetExtensionProcessManager();
88 ExtensionProcessManager::const_iterator iter; 88 ExtensionProcessManager::const_iterator iter;
89 for (iter = process_manager->begin(); iter != process_manager->end(); 89 ExtensionProcessManager::ExtensionHostSet platform_app_hosts =
90 process_manager->platform_app_hosts();
91 for (iter = platform_app_hosts.begin(); iter != platform_app_hosts.end();
90 ++iter) { 92 ++iter) {
91 ExtensionHost* host = *iter; 93 if ((*iter)->extension())
92 if (host->extension() && host->extension()->is_platform_app())
93 count++; 94 count++;
94 } 95 }
95 96
96 return count; 97 return count;
97 } 98 }
98 99
99 // Gets the WebContents associated with the ExtensionHost of the first 100 // Gets the WebContents associated with the ExtensionHost of the first
100 // platform app that is found (most tests only deal with one platform 101 // platform app that is found (most tests only deal with one platform
101 // app, so this is good enough). 102 // app, so this is good enough).
102 WebContents* GetFirstPlatformAppWebContents() { 103 WebContents* GetFirstPlatformAppWebContents() {
103 ExtensionProcessManager* process_manager = 104 ExtensionProcessManager* process_manager =
104 browser()->profile()->GetExtensionProcessManager(); 105 browser()->profile()->GetExtensionProcessManager();
105 ExtensionProcessManager::const_iterator iter; 106 ExtensionProcessManager::const_iterator iter;
106 for (iter = process_manager->begin(); iter != process_manager->end(); 107 ExtensionProcessManager::ExtensionHostSet platform_app_hosts =
108 process_manager->platform_app_hosts();
109 for (iter = platform_app_hosts.begin(); iter != platform_app_hosts.end();
107 ++iter) { 110 ++iter) {
108 ExtensionHost* host = *iter; 111 return (*iter)->host_contents();
109 if (host->extension() && host->extension()->is_platform_app())
110 return host->host_contents();
111 } 112 }
112 113
113 return NULL; 114 return NULL;
114 } 115 }
115 }; 116 };
116 117
117 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenAppInShellContainer) { 118 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenAppInShellContainer) {
118 ASSERT_EQ(0u, GetPlatformAppCount()); 119 ASSERT_EQ(0u, GetPlatformAppCount());
119 LoadAndLaunchPlatformApp("empty"); 120 LoadAndLaunchPlatformApp("empty");
120 ASSERT_EQ(1u, GetPlatformAppCount()); 121 ASSERT_EQ(1u, GetPlatformAppCount());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #if defined(USE_AURA) 190 #if defined(USE_AURA)
190 // On Aura, this currently fails because the window width is returned as 256 191 // On Aura, this currently fails because the window width is returned as 256
191 // instead of 250. See http://crbug.com/119410. 192 // instead of 250. See http://crbug.com/119410.
192 #define MAYBE_WindowsApi FAILS_WindowsApi 193 #define MAYBE_WindowsApi FAILS_WindowsApi
193 #else 194 #else
194 #define MAYBE_WindowsApi WindowsApi 195 #define MAYBE_WindowsApi WindowsApi
195 #endif 196 #endif
196 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WindowsApi) { 197 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WindowsApi) {
197 ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_; 198 ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_;
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698