OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | |
8 #include <vector> | |
7 | 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | |
10 #include "base/callback.h" | 13 #include "base/callback.h" |
11 #include "base/command_line.h" | 14 #include "base/command_line.h" |
12 #include "base/file_util.h" | 15 #include "base/file_util.h" |
13 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
14 #include "base/json/json_reader.h" | 17 #include "base/json/json_reader.h" |
15 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
17 #include "base/path_service.h" | 20 #include "base/path_service.h" |
18 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
19 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
20 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
21 #include "base/values.h" | 24 #include "base/values.h" |
22 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 27 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
25 #include "chrome/browser/chromeos/login/login_display_host.h" | 28 #include "chrome/browser/chromeos/login/login_display_host.h" |
26 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 29 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
27 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" | 30 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" |
28 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" | 31 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" |
29 #include "chrome/browser/chromeos/login/user.h" | 32 #include "chrome/browser/chromeos/login/user.h" |
30 #include "chrome/browser/chromeos/login/user_manager.h" | 33 #include "chrome/browser/chromeos/login/user_manager.h" |
31 #include "chrome/browser/chromeos/login/webui_login_view.h" | 34 #include "chrome/browser/chromeos/login/webui_login_view.h" |
32 #include "chrome/browser/chromeos/login/wizard_controller.h" | 35 #include "chrome/browser/chromeos/login/wizard_controller.h" |
33 #include "chrome/browser/chromeos/policy/device_local_account.h" | 36 #include "chrome/browser/chromeos/policy/device_local_account.h" |
34 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 37 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
35 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 38 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
39 #include "chrome/browser/extensions/extension_service.h" | |
40 #include "chrome/browser/extensions/extension_system.h" | |
36 #include "chrome/browser/lifetime/application_lifetime.h" | 41 #include "chrome/browser/lifetime/application_lifetime.h" |
37 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 42 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
38 #include "chrome/browser/policy/cloud/policy_builder.h" | 43 #include "chrome/browser/policy/cloud/policy_builder.h" |
39 #include "chrome/browser/policy/policy_service.h" | 44 #include "chrome/browser/policy/policy_service.h" |
40 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" | 45 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" |
41 #include "chrome/browser/policy/test/local_policy_test_server.h" | 46 #include "chrome/browser/policy/test/local_policy_test_server.h" |
42 #include "chrome/browser/prefs/session_startup_pref.h" | 47 #include "chrome/browser/prefs/session_startup_pref.h" |
43 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
44 #include "chrome/browser/profiles/profile_manager.h" | 49 #include "chrome/browser/profiles/profile_manager.h" |
45 #include "chrome/browser/ui/browser.h" | 50 #include "chrome/browser/ui/browser.h" |
46 #include "chrome/browser/ui/browser_commands.h" | 51 #include "chrome/browser/ui/browser_commands.h" |
47 #include "chrome/browser/ui/browser_finder.h" | 52 #include "chrome/browser/ui/browser_finder.h" |
48 #include "chrome/browser/ui/browser_list.h" | 53 #include "chrome/browser/ui/browser_list.h" |
49 #include "chrome/browser/ui/browser_window.h" | 54 #include "chrome/browser/ui/browser_window.h" |
50 #include "chrome/browser/ui/host_desktop.h" | 55 #include "chrome/browser/ui/host_desktop.h" |
51 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 56 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
52 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 57 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
53 #include "chrome/common/chrome_paths.h" | 58 #include "chrome/common/chrome_paths.h" |
54 #include "chrome/common/chrome_switches.h" | 59 #include "chrome/common/chrome_switches.h" |
60 #include "chrome/common/extensions/extension.h" | |
55 #include "chromeos/chromeos_switches.h" | 61 #include "chromeos/chromeos_switches.h" |
56 #include "chromeos/dbus/cryptohome_client.h" | 62 #include "chromeos/dbus/cryptohome_client.h" |
57 #include "chromeos/dbus/dbus_method_call_status.h" | 63 #include "chromeos/dbus/dbus_method_call_status.h" |
58 #include "chromeos/dbus/fake_cryptohome_client.h" | 64 #include "chromeos/dbus/fake_cryptohome_client.h" |
59 #include "chromeos/dbus/fake_session_manager_client.h" | 65 #include "chromeos/dbus/fake_session_manager_client.h" |
60 #include "chromeos/dbus/session_manager_client.h" | 66 #include "chromeos/dbus/session_manager_client.h" |
67 #include "content/public/browser/notification_details.h" | |
61 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
62 #include "content/public/browser/web_ui.h" | 69 #include "content/public/browser/web_ui.h" |
63 #include "content/public/test/browser_test_utils.h" | 70 #include "content/public/test/browser_test_utils.h" |
64 #include "content/public/test/test_utils.h" | 71 #include "content/public/test/test_utils.h" |
65 #include "crypto/rsa_private_key.h" | 72 #include "crypto/rsa_private_key.h" |
66 #include "grit/chromium_strings.h" | 73 #include "grit/chromium_strings.h" |
67 #include "grit/generated_resources.h" | 74 #include "grit/generated_resources.h" |
75 #include "net/http/http_status_code.h" | |
68 #include "net/test/embedded_test_server/embedded_test_server.h" | 76 #include "net/test/embedded_test_server/embedded_test_server.h" |
77 #include "net/test/embedded_test_server/http_request.h" | |
78 #include "net/test/embedded_test_server/http_response.h" | |
69 #include "testing/gmock/include/gmock/gmock.h" | 79 #include "testing/gmock/include/gmock/gmock.h" |
70 #include "third_party/cros_system_api/dbus/service_constants.h" | 80 #include "third_party/cros_system_api/dbus/service_constants.h" |
71 #include "ui/base/l10n/l10n_util.h" | 81 #include "ui/base/l10n/l10n_util.h" |
72 #include "url/gurl.h" | 82 #include "url/gurl.h" |
73 | 83 |
74 namespace em = enterprise_management; | 84 namespace em = enterprise_management; |
75 | 85 |
76 using testing::InvokeWithoutArgs; | 86 using testing::InvokeWithoutArgs; |
77 using testing::Return; | 87 using testing::Return; |
78 using testing::_; | 88 using testing::_; |
79 | 89 |
80 namespace policy { | 90 namespace policy { |
81 | 91 |
82 namespace { | 92 namespace { |
83 | 93 |
84 const char kDomain[] = "example.com"; | 94 const char kDomain[] = "example.com"; |
85 const char kAccountId1[] = "dla1@example.com"; | 95 const char kAccountId1[] = "dla1@example.com"; |
86 const char kAccountId2[] = "dla2@example.com"; | 96 const char kAccountId2[] = "dla2@example.com"; |
87 const char kDisplayName[] = "display name"; | 97 const char kDisplayName[] = "display name"; |
88 const char* kStartupURLs[] = { | 98 const char* kStartupURLs[] = { |
89 "chrome://policy", | 99 "chrome://policy", |
90 "chrome://about", | 100 "chrome://about", |
91 }; | 101 }; |
92 const char kExistentTermsOfServicePath[] = "chromeos/enterprise/tos.txt"; | 102 const char kExistentTermsOfServicePath[] = "chromeos/enterprise/tos.txt"; |
93 const char kNonexistentTermsOfServicePath[] = "chromeos/enterprise/tos404.txt"; | 103 const char kNonexistentTermsOfServicePath[] = "chromeos/enterprise/tos404.txt"; |
104 const char kUpdatePath[] = "/service/update2/crx"; | |
105 const char kUpdateManifestHeader[] = | |
106 "<?xml version='1.0' encoding='UTF-8'?>\n" | |
107 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>\n"; | |
108 const char kUpdateManifestTemplate[] = | |
109 " <app appid='$1'>\n" | |
110 " <updatecheck codebase='$2' version='$3' />\n" | |
111 " </app>\n"; | |
112 const char kUpdateManifestFooter[] = | |
113 "</gupdate>\n"; | |
114 const char kHostedAppID[] = "kbmnembihfiondgfjekmnmcbddelicoi"; | |
115 const char kHostedAppCRXPath[] = "extensions/hosted_app.crx"; | |
116 const char kHostedAppVersion[] = "0.1"; | |
117 const char kGoodExtensionID[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; | |
118 const char kGoodExtensionPath[] = "extensions/good.crx"; | |
119 const char kGoodExtensionVersion[] = "1.0"; | |
120 | |
121 class ExtensionInstallSuccessObserver | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
Is there any good reasons to make these classes if
bartfab (slow)
2013/09/23 17:03:05
CheckNotification() needs to access the Notificati
Mattias Nissler (ping if slow)
2013/09/25 12:04:08
Sounds like a subclass for WindowedNotificationObs
bartfab (slow)
2013/09/26 12:39:13
Done.
| |
122 : public content::WindowedNotificationObserver { | |
123 public: | |
124 explicit ExtensionInstallSuccessObserver(const std::string& id); | |
125 ~ExtensionInstallSuccessObserver(); | |
126 | |
127 private: | |
128 bool CheckNotification(); | |
129 | |
130 const std::string id_; | |
131 | |
132 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallSuccessObserver); | |
133 }; | |
134 | |
135 class ExtensionInstallFailureObserver | |
136 : public content::WindowedNotificationObserver { | |
137 public: | |
138 explicit ExtensionInstallFailureObserver(const std::string& id); | |
139 ~ExtensionInstallFailureObserver(); | |
140 | |
141 private: | |
142 bool CheckNotification(); | |
143 | |
144 const string16 id_; | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
Why is this a string16, while it is a std::string
bartfab (slow)
2013/09/23 17:03:05
They listen for different notification types. An i
Mattias Nissler (ping if slow)
2013/09/25 12:04:08
Doh. Does the extension team have a bug for this?
bartfab (slow)
2013/09/26 12:39:13
Filed crbug.com/298810
| |
145 | |
146 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallFailureObserver); | |
147 }; | |
148 | |
149 ExtensionInstallSuccessObserver::ExtensionInstallSuccessObserver( | |
150 const std::string& id) | |
151 : content::WindowedNotificationObserver( | |
152 chrome::NOTIFICATION_EXTENSION_INSTALLED, | |
153 base::Bind(&ExtensionInstallSuccessObserver::CheckNotification, | |
154 base::Unretained(this))), | |
155 id_(id) { | |
156 } | |
157 | |
158 ExtensionInstallSuccessObserver::~ExtensionInstallSuccessObserver() { | |
159 } | |
160 | |
161 bool ExtensionInstallSuccessObserver::CheckNotification() { | |
162 return content::Details<const extensions::InstalledExtensionInfo>( | |
163 details())->extension->id() == id_; | |
164 } | |
165 | |
166 ExtensionInstallFailureObserver::ExtensionInstallFailureObserver( | |
167 const std::string& id) | |
168 : content::WindowedNotificationObserver( | |
169 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | |
170 base::Bind(&ExtensionInstallFailureObserver::CheckNotification, | |
171 base::Unretained(this))), | |
172 id_(UTF8ToUTF16(id)) { | |
173 } | |
174 | |
175 ExtensionInstallFailureObserver::~ExtensionInstallFailureObserver() { | |
176 } | |
177 | |
178 bool ExtensionInstallFailureObserver::CheckNotification() { | |
179 return content::Details<const string16>(details())->find(id_) != | |
180 string16::npos; | |
181 } | |
94 | 182 |
95 } // namespace | 183 } // namespace |
96 | 184 |
97 class DeviceLocalAccountTest : public DevicePolicyCrosBrowserTest { | 185 class DeviceLocalAccountTest : public DevicePolicyCrosBrowserTest { |
186 public: | |
187 scoped_ptr<net::test_server::HttpResponse> HandleRequest( | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
I guess it would be good to factor this out so oth
bartfab (slow)
2013/09/23 17:03:05
Refactored into a reusable TestingUpdateManifestPr
| |
188 const net::test_server::HttpRequest& request) { | |
189 if (request.relative_url.find(kUpdatePath) != 0) | |
190 return scoped_ptr<net::test_server::HttpResponse>(); | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
nit: blank line here for readability
bartfab (slow)
2013/09/23 17:03:05
Done.
| |
191 std::string content = kUpdateManifestHeader; | |
192 size_t id_pos = 0; | |
193 while ((id_pos = request.relative_url.find("id%3D", id_pos)) != | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
Can you use proper URL parsing, for GetValueForKey
bartfab (slow)
2013/09/23 17:03:05
Re GetValueForKeyInQuery(): Unfortunately, I canno
Mattias Nissler (ping if slow)
2013/09/25 12:04:08
Ad hoc URL parsing still isn't a good idea. Note t
bartfab (slow)
2013/09/26 12:39:13
Done.
| |
194 std::string::npos) { | |
195 id_pos += 5; | |
196 const std::string id = request.relative_url.substr(id_pos, 32); | |
197 id_pos += 32; | |
198 ExtensionMap::const_iterator entry = extension_map_.find(id); | |
199 if (entry != extension_map_.end()) { | |
200 std::vector<std::string> parts; | |
201 parts.push_back(id); | |
202 parts.push_back(embedded_test_server()->GetURL( | |
203 std::string("/") + entry->second.first).spec()); | |
204 parts.push_back(entry->second.second); | |
205 content += ReplaceStringPlaceholders( | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
base::StringPrintf is probably simpler to use here
bartfab (slow)
2013/09/23 17:03:05
Funny. I specifically chose ReplaceStringPlacehold
| |
206 kUpdateManifestTemplate, parts, NULL); | |
207 } | |
208 } | |
209 content += kUpdateManifestFooter; | |
210 scoped_ptr<net::test_server::BasicHttpResponse> | |
211 http_response(new net::test_server::BasicHttpResponse); | |
212 http_response->set_code(net::HTTP_OK); | |
213 http_response->set_content(content); | |
214 http_response->set_content_type("text/xml"); | |
215 return http_response.PassAs<net::test_server::HttpResponse>(); | |
216 } | |
217 | |
98 protected: | 218 protected: |
99 DeviceLocalAccountTest() | 219 DeviceLocalAccountTest() |
100 : user_id_1_(GenerateDeviceLocalAccountUserId( | 220 : user_id_1_(GenerateDeviceLocalAccountUserId( |
101 kAccountId1, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 221 kAccountId1, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
102 user_id_2_(GenerateDeviceLocalAccountUserId( | 222 user_id_2_(GenerateDeviceLocalAccountUserId( |
103 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)) {} | 223 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)) {} |
104 | 224 |
105 virtual ~DeviceLocalAccountTest() {} | 225 virtual ~DeviceLocalAccountTest() {} |
106 | 226 |
107 virtual void SetUp() OVERRIDE { | 227 virtual void SetUp() OVERRIDE { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 ASSERT_TRUE(user); | 321 ASSERT_TRUE(user); |
202 EXPECT_EQ(id, user->email()); | 322 EXPECT_EQ(id, user->email()); |
203 EXPECT_EQ(chromeos::User::USER_TYPE_PUBLIC_ACCOUNT, user->GetType()); | 323 EXPECT_EQ(chromeos::User::USER_TYPE_PUBLIC_ACCOUNT, user->GetType()); |
204 } | 324 } |
205 | 325 |
206 const std::string user_id_1_; | 326 const std::string user_id_1_; |
207 const std::string user_id_2_; | 327 const std::string user_id_2_; |
208 | 328 |
209 UserPolicyBuilder device_local_account_policy_; | 329 UserPolicyBuilder device_local_account_policy_; |
210 LocalPolicyTestServer test_server_; | 330 LocalPolicyTestServer test_server_; |
331 | |
332 typedef std::map<std::string, std::pair<std::string, std::string> > | |
333 ExtensionMap; | |
334 ExtensionMap extension_map_; | |
211 }; | 335 }; |
212 | 336 |
213 static bool IsKnownUser(const std::string& account_id) { | 337 static bool IsKnownUser(const std::string& account_id) { |
214 return chromeos::UserManager::Get()->IsKnownUser(account_id); | 338 return chromeos::UserManager::Get()->IsKnownUser(account_id); |
215 } | 339 } |
216 | 340 |
217 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, LoginScreen) { | 341 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, LoginScreen) { |
218 AddPublicSessionToDevicePolicy(kAccountId1); | 342 AddPublicSessionToDevicePolicy(kAccountId1); |
219 AddPublicSessionToDevicePolicy(kAccountId2); | 343 AddPublicSessionToDevicePolicy(kAccountId2); |
220 | 344 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 BrowserWindow* browser_window = browser->window(); | 538 BrowserWindow* browser_window = browser->window(); |
415 ASSERT_TRUE(browser_window); | 539 ASSERT_TRUE(browser_window); |
416 chrome::EndKeepAlive(); | 540 chrome::EndKeepAlive(); |
417 | 541 |
418 // Verify that an attempt to enter fullscreen mode is denied. | 542 // Verify that an attempt to enter fullscreen mode is denied. |
419 EXPECT_FALSE(browser_window->IsFullscreen()); | 543 EXPECT_FALSE(browser_window->IsFullscreen()); |
420 chrome::ToggleFullscreenMode(browser); | 544 chrome::ToggleFullscreenMode(browser); |
421 EXPECT_FALSE(browser_window->IsFullscreen()); | 545 EXPECT_FALSE(browser_window->IsFullscreen()); |
422 } | 546 } |
423 | 547 |
548 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionWhitelist) { | |
549 // Make it possible to force-install a hosted app and an extension. | |
550 extension_map_[kHostedAppID] = | |
551 std::pair<std::string, std::string>(kHostedAppCRXPath, | |
552 kHostedAppVersion); | |
553 extension_map_[kGoodExtensionID] = | |
554 std::pair<std::string, std::string>(kGoodExtensionPath, | |
555 kGoodExtensionVersion); | |
556 | |
557 // Specify policy to force-install the hosted app and the extension. | |
558 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
559 embedded_test_server()->RegisterRequestHandler( | |
560 base::Bind(&DeviceLocalAccountTest::HandleRequest, | |
561 base::Unretained(this))); | |
562 em::StringList* forcelist = device_local_account_policy_.payload() | |
563 .mutable_extensioninstallforcelist()->mutable_value(); | |
564 std::vector<std::string> parts; | |
565 parts.push_back(kHostedAppID); | |
566 parts.push_back(embedded_test_server()->GetURL(kUpdatePath).spec()); | |
567 forcelist->add_entries(ReplaceStringPlaceholders("$1;$2", parts, NULL)); | |
Mattias Nissler (ping if slow)
2013/09/23 12:53:29
StringPrintf is simpler
bartfab (slow)
2013/09/23 17:03:05
Done.
| |
568 parts.clear(); | |
569 parts.push_back(kGoodExtensionID); | |
570 parts.push_back(embedded_test_server()->GetURL(kUpdatePath).spec()); | |
571 forcelist->add_entries(ReplaceStringPlaceholders("$1;$2", parts, NULL)); | |
572 | |
573 UploadAndInstallDeviceLocalAccountPolicy(); | |
574 AddPublicSessionToDevicePolicy(kAccountId1); | |
575 | |
576 // This observes the display name becoming available as this indicates | |
577 // device-local account policy is fully loaded, which is a prerequisite for | |
578 // successful login. | |
579 content::WindowedNotificationObserver( | |
580 chrome::NOTIFICATION_USER_LIST_CHANGED, | |
581 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName)).Wait(); | |
582 | |
583 // Wait for the login UI to be ready. | |
584 chromeos::LoginDisplayHostImpl* host = | |
585 reinterpret_cast<chromeos::LoginDisplayHostImpl*>( | |
586 chromeos::LoginDisplayHostImpl::default_host()); | |
587 ASSERT_TRUE(host); | |
588 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); | |
589 ASSERT_TRUE(oobe_ui); | |
590 base::RunLoop run_loop; | |
591 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); | |
592 if (!oobe_ui_ready) | |
593 run_loop.Run(); | |
594 | |
595 // Ensure that the browser stays alive, even though no windows are opened | |
596 // during session start. | |
597 chrome::StartKeepAlive(); | |
598 | |
599 // Start listening for app/extension installation results. | |
600 ExtensionInstallSuccessObserver hosted_app_observer(kHostedAppID); | |
601 ExtensionInstallFailureObserver extension_observer(kGoodExtensionID); | |
602 | |
603 // Start login into the device-local account. | |
604 host->StartSignInScreen(); | |
605 chromeos::ExistingUserController* controller = | |
606 chromeos::ExistingUserController::current_controller(); | |
607 ASSERT_TRUE(controller); | |
608 controller->LoginAsPublicAccount(user_id_1_); | |
609 | |
610 // Wait for the hosted app installation to succeed and the extension | |
611 // installation to fail. | |
612 hosted_app_observer.Wait(); | |
613 extension_observer.Wait(); | |
614 | |
615 // Verify that the hosted app was installed. | |
616 Profile* profile = ProfileManager::GetDefaultProfile(); | |
617 ASSERT_TRUE(profile); | |
618 ExtensionService* extension_service = | |
619 extensions::ExtensionSystem::Get(profile)->extension_service(); | |
620 EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true)); | |
621 | |
622 // Verify that the extension was not installed. | |
623 EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true)); | |
624 } | |
625 | |
424 class TermsOfServiceTest : public DeviceLocalAccountTest, | 626 class TermsOfServiceTest : public DeviceLocalAccountTest, |
425 public testing::WithParamInterface<bool> { | 627 public testing::WithParamInterface<bool> { |
426 }; | 628 }; |
427 | 629 |
428 IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) { | 630 IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) { |
429 // Specify Terms of Service URL. | 631 // Specify Terms of Service URL. |
430 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 632 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
431 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( | 633 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( |
432 embedded_test_server()->GetURL( | 634 embedded_test_server()->GetURL( |
433 std::string("/") + | 635 std::string("/") + |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 if (!IsSessionStarted()) { | 777 if (!IsSessionStarted()) { |
576 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, | 778 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, |
577 base::Bind(IsSessionStarted)).Wait(); | 779 base::Bind(IsSessionStarted)).Wait(); |
578 } | 780 } |
579 } | 781 } |
580 | 782 |
581 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, | 783 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, |
582 TermsOfServiceTest, testing::Bool()); | 784 TermsOfServiceTest, testing::Bool()); |
583 | 785 |
584 } // namespace policy | 786 } // namespace policy |
OLD | NEW |