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

Side by Side Diff: chrome/test/remoting/remote_desktop_browsertest.cc

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 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
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/test/remoting/remote_desktop_browsertest.h" 5 #include "chrome/test/remoting/remote_desktop_browsertest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/unpacked_installer.h" 12 #include "chrome/browser/extensions/unpacked_installer.h"
13 #include "chrome/browser/ui/extensions/application_launch.h" 13 #include "chrome/browser/ui/extensions/application_launch.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/remoting/key_code_conv.h" 15 #include "chrome/test/remoting/key_code_conv.h"
16 #include "chrome/test/remoting/page_load_notification_observer.h" 16 #include "chrome/test/remoting/page_load_notification_observer.h"
17 #include "chrome/test/remoting/waiter.h" 17 #include "chrome/test/remoting/waiter.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 18 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "extensions/browser/extension_registry.h"
21 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
22 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_set.h" 24 #include "extensions/common/extension_set.h"
24 #include "extensions/common/switches.h" 25 #include "extensions/common/switches.h"
25 #include "ui/base/window_open_disposition.h" 26 #include "ui/base/window_open_disposition.h"
26 27
27 namespace remoting { 28 namespace remoting {
28 29
29 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest() 30 RemoteDesktopBrowserTest::RemoteDesktopBrowserTest()
30 : extension_(NULL) { 31 : extension_(NULL) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 observer.Wait(); 129 observer.Wait();
129 } 130 }
130 131
131 void RemoteDesktopBrowserTest::UninstallChromotingApp() { 132 void RemoteDesktopBrowserTest::UninstallChromotingApp() {
132 UninstallExtension(ChromotingID()); 133 UninstallExtension(ChromotingID());
133 extension_ = NULL; 134 extension_ = NULL;
134 } 135 }
135 136
136 void RemoteDesktopBrowserTest::VerifyChromotingLoaded(bool expected) { 137 void RemoteDesktopBrowserTest::VerifyChromotingLoaded(bool expected) {
137 const extensions::ExtensionSet* extensions =
138 extension_service()->extensions();
139 scoped_refptr<const extensions::Extension> extension;
140 bool installed = false; 138 bool installed = false;
141 139
142 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); 140 for (const scoped_refptr<const extensions::Extension>& extension :
143 iter != extensions->end(); ++iter) { 141 extensions::ExtensionRegistry::Get(profile())->enabled_extensions()) {
144 extension = *iter;
145 // Is there a better way to recognize the chromoting extension 142 // Is there a better way to recognize the chromoting extension
146 // than name comparison? 143 // than name comparison?
147 if (extension->name() == extension_name_) { 144 if (extension->name() == extension_name_) {
145 if (extension_) {
146 EXPECT_EQ(extension.get(), extension_);
147 } else {
148 extension_ = extension.get();
149 }
150
148 installed = true; 151 installed = true;
149 break; 152 break;
150 } 153 }
151 } 154 }
152 155
153 if (installed) { 156 if (installed) {
154 if (extension_)
155 EXPECT_EQ(extension.get(), extension_);
156 else
157 extension_ = extension.get();
158
159 // Either a V1 (TYPE_LEGACY_PACKAGED_APP) or a V2 (TYPE_PLATFORM_APP ) app. 157 // Either a V1 (TYPE_LEGACY_PACKAGED_APP) or a V2 (TYPE_PLATFORM_APP ) app.
160 extensions::Manifest::Type type = extension->GetType(); 158 extensions::Manifest::Type type = extension_->GetType();
161 EXPECT_TRUE(type == extensions::Manifest::TYPE_PLATFORM_APP || 159 EXPECT_TRUE(type == extensions::Manifest::TYPE_PLATFORM_APP ||
162 type == extensions::Manifest::TYPE_LEGACY_PACKAGED_APP); 160 type == extensions::Manifest::TYPE_LEGACY_PACKAGED_APP);
163 161
164 EXPECT_TRUE(extension->ShouldDisplayInAppLauncher()); 162 EXPECT_TRUE(extension_->ShouldDisplayInAppLauncher());
165 } 163 }
166 164
167 ASSERT_EQ(installed, expected); 165 ASSERT_EQ(installed, expected);
168 } 166 }
169 167
170 void RemoteDesktopBrowserTest::LaunchChromotingApp() { 168 void RemoteDesktopBrowserTest::LaunchChromotingApp() {
171 ASSERT_TRUE(extension_); 169 ASSERT_TRUE(extension_);
172 170
173 GURL chromoting_main = Chromoting_Main_URL(); 171 GURL chromoting_main = Chromoting_Main_URL();
174 // We cannot simply wait for any page load because the first page 172 // We cannot simply wait for any page load because the first page
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // static 857 // static
860 bool RemoteDesktopBrowserTest::IsEnabled( 858 bool RemoteDesktopBrowserTest::IsEnabled(
861 content::WebContents* client_web_content, 859 content::WebContents* client_web_content,
862 const std::string& element_name) { 860 const std::string& element_name) {
863 return !ExecuteScriptAndExtractBool( 861 return !ExecuteScriptAndExtractBool(
864 client_web_content, 862 client_web_content,
865 "document.getElementById(\"" + element_name + "\").disabled"); 863 "document.getElementById(\"" + element_name + "\").disabled");
866 } 864 }
867 865
868 } // namespace remoting 866 } // namespace remoting
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698