OLD | NEW |
---|---|
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/browser/chromeos/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/prefs/scoped_user_pref_update.h" | 12 #include "base/prefs/scoped_user_pref_update.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" | 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" |
17 #include "chrome/browser/chromeos/app_mode/kiosk_test_common.h" | |
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
18 #include "chrome/browser/chromeos/policy/device_local_account.h" | 19 #include "chrome/browser/chromeos/policy/device_local_account.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
24 #include "chromeos/settings/cros_settings_names.h" | 25 #include "chromeos/settings/cros_settings_names.h" |
25 #include "content/public/test/test_utils.h" | 26 #include "content/public/test/test_utils.h" |
26 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
27 #include "net/base/host_port_pair.h" | 28 #include "net/base/host_port_pair.h" |
28 #include "net/dns/mock_host_resolver.h" | 29 #include "net/dns/mock_host_resolver.h" |
29 #include "net/test/embedded_test_server/embedded_test_server.h" | 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
30 | 31 |
31 namespace chromeos { | 32 namespace chromeos { |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 const char kWebstoreDomain[] = "cws.com"; | 36 const char kWebstoreDomain[] = "cws.com"; |
36 | 37 |
38 // An app to test local fs data persistence across app update. V1 app writes | |
39 // data into local fs. V2 app reads and verifies the data. | |
40 // Webstore data json is in | |
41 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ | |
42 // detail/bmbpicmpniaclbbpdkfglgipkkebnbjf | |
43 // The version 1.0.0 installed is in | |
44 // chrome/test/data/chromeos/app_mode/webstore/downloads/ | |
45 // bmbpicmpniaclbbpdkfglgipkkebnbjf.crx | |
46 // The version 2.0.0 crx is in | |
47 // chrome/test/data/chromeos/app_mode/webstore/downloads/ | |
48 // bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx | |
49 const char kTestLocalFsKioskApp[] = "bmbpicmpniaclbbpdkfglgipkkebnbjf"; | |
50 const char kTestLocalFsKioskAppName[] = "Kiosk App With Local Data"; | |
51 | |
52 // Kiosk app crx file download path under web store site. | |
53 const char kCrxDownloadPath[] = "/webstore/downloads/"; | |
xiyuan
2014/05/09 20:49:15
This feels like part of KioskTestCommon (FakeCWS).
jennyz
2014/05/13 00:31:21
Done.
| |
54 | |
37 // Helper KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback | 55 // Helper KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback |
38 // implementation. | 56 // implementation. |
39 void ConsumerKioskAutoLaunchStatusCheck( | 57 void ConsumerKioskAutoLaunchStatusCheck( |
40 KioskAppManager::ConsumerKioskAutoLaunchStatus* out_status, | 58 KioskAppManager::ConsumerKioskAutoLaunchStatus* out_status, |
41 const base::Closure& runner_quit_task, | 59 const base::Closure& runner_quit_task, |
42 KioskAppManager::ConsumerKioskAutoLaunchStatus in_status) { | 60 KioskAppManager::ConsumerKioskAutoLaunchStatus in_status) { |
43 LOG(INFO) << "ConsumerKioskAutoLaunchStatus = " << in_status; | 61 LOG(INFO) << "ConsumerKioskAutoLaunchStatus = " << in_status; |
44 *out_status = in_status; | 62 *out_status = in_status; |
45 runner_quit_task.Run(); | 63 runner_quit_task.Run(); |
46 } | 64 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 int data_changed_count_; | 137 int data_changed_count_; |
120 int load_failure_count_; | 138 int load_failure_count_; |
121 | 139 |
122 DISALLOW_COPY_AND_ASSIGN(TestKioskAppManagerObserver); | 140 DISALLOW_COPY_AND_ASSIGN(TestKioskAppManagerObserver); |
123 }; | 141 }; |
124 | 142 |
125 class AppDataLoadWaiter : public KioskAppManagerObserver { | 143 class AppDataLoadWaiter : public KioskAppManagerObserver { |
126 public: | 144 public: |
127 explicit AppDataLoadWaiter(KioskAppManager* manager) | 145 explicit AppDataLoadWaiter(KioskAppManager* manager) |
128 : manager_(manager), | 146 : manager_(manager), |
129 loaded_(false) { | 147 loaded_(false), |
130 } | 148 data_change_count_(0), |
149 data_loaded_threshold_(1) {} | |
150 | |
151 AppDataLoadWaiter(KioskAppManager* manager, int data_loaded_threshold) | |
xiyuan
2014/05/09 20:49:15
Let's keep just this one and remove the one in lin
jennyz
2014/05/13 00:31:21
Done.
| |
152 : manager_(manager), | |
153 loaded_(false), | |
154 data_change_count_(0), | |
155 data_loaded_threshold_(data_loaded_threshold) {} | |
131 | 156 |
132 virtual ~AppDataLoadWaiter() { | 157 virtual ~AppDataLoadWaiter() { |
133 } | 158 } |
134 | 159 |
135 void Wait() { | 160 void Wait() { |
136 manager_->AddObserver(this); | 161 manager_->AddObserver(this); |
xiyuan
2014/05/09 20:49:15
This might need to go into ctor and RemoveObserver
jennyz
2014/05/13 00:31:21
Done.
| |
137 runner_ = new content::MessageLoopRunner; | 162 runner_ = new content::MessageLoopRunner; |
138 runner_->Run(); | 163 runner_->Run(); |
139 manager_->RemoveObserver(this); | 164 manager_->RemoveObserver(this); |
140 } | 165 } |
141 | 166 |
142 bool loaded() const { return loaded_; } | 167 bool loaded() const { return loaded_; } |
143 | 168 |
144 private: | 169 private: |
145 // KioskAppManagerObserver overrides: | 170 // KioskAppManagerObserver overrides: |
146 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { | 171 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { |
172 ++data_change_count_; | |
173 if (data_change_count_ < data_loaded_threshold_) | |
174 return; | |
147 loaded_ = true; | 175 loaded_ = true; |
148 runner_->Quit(); | 176 runner_->Quit(); |
149 } | 177 } |
150 | 178 |
151 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { | 179 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { |
152 loaded_ = false; | 180 loaded_ = false; |
153 runner_->Quit(); | 181 runner_->Quit(); |
154 } | 182 } |
155 | 183 |
156 scoped_refptr<content::MessageLoopRunner> runner_; | 184 scoped_refptr<content::MessageLoopRunner> runner_; |
157 KioskAppManager* manager_; | 185 KioskAppManager* manager_; |
158 bool loaded_; | 186 bool loaded_; |
187 int data_change_count_; | |
188 int data_loaded_threshold_; | |
159 | 189 |
160 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); | 190 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); |
161 }; | 191 }; |
162 | 192 |
163 } // namespace | 193 } // namespace |
164 | 194 |
165 class KioskAppManagerTest : public InProcessBrowserTest { | 195 class KioskAppManagerTest : public InProcessBrowserTest, |
196 public KioskTestCommon { | |
166 public: | 197 public: |
167 KioskAppManagerTest() {} | 198 KioskAppManagerTest() {} |
168 virtual ~KioskAppManagerTest() {} | 199 virtual ~KioskAppManagerTest() {} |
169 | 200 |
170 // InProcessBrowserTest overrides: | 201 // InProcessBrowserTest overrides: |
171 virtual void SetUp() OVERRIDE { | 202 virtual void SetUp() OVERRIDE { |
172 base::FilePath test_data_dir; | 203 base::FilePath test_data_dir; |
173 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 204 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
174 base::FilePath webstore_dir = | 205 base::FilePath webstore_dir = |
175 test_data_dir.Append(FILE_PATH_LITERAL("chromeos/app_mode/")); | 206 test_data_dir.Append(FILE_PATH_LITERAL("chromeos/app_mode/")); |
(...skipping 10 matching lines...) Expand all Loading... | |
186 | 217 |
187 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 218 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
188 InProcessBrowserTest::SetUpCommandLine(command_line); | 219 InProcessBrowserTest::SetUpCommandLine(command_line); |
189 | 220 |
190 // Get fake webstore gallery URL. At the end, it should look something like | 221 // Get fake webstore gallery URL. At the end, it should look something like |
191 // http://cws.com:<test_server_port>/webstore. | 222 // http://cws.com:<test_server_port>/webstore. |
192 const GURL& server_url = embedded_test_server()->base_url(); | 223 const GURL& server_url = embedded_test_server()->base_url(); |
193 std::string google_host(kWebstoreDomain); | 224 std::string google_host(kWebstoreDomain); |
194 GURL::Replacements replace_google_host; | 225 GURL::Replacements replace_google_host; |
195 replace_google_host.SetHostStr(google_host); | 226 replace_google_host.SetHostStr(google_host); |
196 GURL google_url = server_url.ReplaceComponents(replace_google_host); | 227 web_store_url_ = server_url.ReplaceComponents(replace_google_host); |
197 GURL fake_store_url = google_url.Resolve("/webstore"); | 228 GURL gallery_url = web_store_url_.Resolve("/webstore"); |
198 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, | 229 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, |
199 fake_store_url.spec()); | 230 gallery_url.spec()); |
200 } | 231 } |
201 | 232 |
202 virtual void SetUpOnMainThread() OVERRIDE { | 233 virtual void SetUpOnMainThread() OVERRIDE { |
203 InProcessBrowserTest::SetUpOnMainThread(); | 234 InProcessBrowserTest::SetUpOnMainThread(); |
204 | 235 |
205 // Restart the thread as the sandbox host process has already been spawned. | 236 // Restart the thread as the sandbox host process has already been spawned. |
206 embedded_test_server()->RestartThreadAndListen(); | 237 embedded_test_server()->RestartThreadAndListen(); |
207 } | 238 } |
208 | 239 |
209 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 240 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 kAccountsPrefDeviceLocalAccountsKeyType, | 307 kAccountsPrefDeviceLocalAccountsKeyType, |
277 policy::DeviceLocalAccount::TYPE_KIOSK_APP); | 308 policy::DeviceLocalAccount::TYPE_KIOSK_APP); |
278 entry->SetStringWithoutPathExpansion( | 309 entry->SetStringWithoutPathExpansion( |
279 kAccountsPrefDeviceLocalAccountsKeyKioskAppId, | 310 kAccountsPrefDeviceLocalAccountsKeyKioskAppId, |
280 app_id); | 311 app_id); |
281 device_local_accounts.Append(entry.release()); | 312 device_local_accounts.Append(entry.release()); |
282 CrosSettings::Get()->Set(kAccountsPrefDeviceLocalAccounts, | 313 CrosSettings::Get()->Set(kAccountsPrefDeviceLocalAccounts, |
283 device_local_accounts); | 314 device_local_accounts); |
284 } | 315 } |
285 | 316 |
317 void SetupCrxDownloads() { | |
318 GURL downloads_url = web_store_url_.Resolve(kCrxDownloadPath); | |
319 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
320 ::switches::kAppsGalleryDownloadURL, downloads_url.spec()); | |
321 } | |
322 | |
323 void SetupCrxUpdate() { | |
324 GURL update_url = web_store_url_.Resolve("/webstore/update_check.xml"); | |
325 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
326 ::switches::kAppsGalleryUpdateURL, update_url.spec()); | |
327 | |
328 embedded_test_server()->RegisterRequestHandler(base::Bind( | |
329 &KioskAppManagerTest::HandleRequest, base::Unretained(this))); | |
330 } | |
331 | |
332 bool GetKioskAppExtension(const std::string& app_id, | |
333 base::FilePath* file_path, | |
334 std::string* version) { | |
335 return manager()->GetKioskAppExtension(app_id, file_path, version); | |
336 } | |
337 | |
338 void UpdateAppData() { manager()->UpdateAppData(); } | |
339 | |
340 void RunAddNewAppTest(const std::string& id, | |
341 const std::string& version, | |
342 const std::string& app_name) { | |
343 SetupCrxDownloads(); | |
344 SetupCrxUpdate(); | |
345 std::string crx_file_name = id + ".crx"; | |
346 SetUpdateCrx(web_store_url_, kCrxDownloadPath, id, crx_file_name, version); | |
347 | |
348 AppDataLoadWaiter waiter(manager(), 2); | |
349 manager()->AddApp(id); | |
350 waiter.Wait(); | |
351 EXPECT_TRUE(waiter.loaded()); | |
352 | |
353 // Check CRX file is cached. | |
354 base::FilePath crx_path; | |
355 std::string crx_version; | |
356 EXPECT_TRUE(GetKioskAppExtension(id, &crx_path, &crx_version)); | |
357 EXPECT_TRUE(base::PathExists(crx_path)); | |
358 EXPECT_EQ(version, crx_version); | |
359 // Verify the original crx file is identical to the cached file. | |
360 base::FilePath test_data_dir; | |
361 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
362 std::string src_file_path_str = | |
363 std::string("chromeos/app_mode/webstore/downloads/") + crx_file_name; | |
364 base::FilePath src_file_path = test_data_dir.Append(src_file_path_str); | |
365 EXPECT_TRUE(base::PathExists(src_file_path)); | |
366 EXPECT_TRUE(base::ContentsEqual(src_file_path, crx_path)); | |
367 | |
368 // Check manifest data is cached correctly. | |
369 KioskAppManager::Apps apps; | |
370 manager()->GetApps(&apps); | |
371 ASSERT_EQ(1u, apps.size()); | |
372 EXPECT_EQ(id, apps[0].app_id); | |
373 EXPECT_EQ(app_name, apps[0].name); | |
374 EXPECT_EQ(gfx::Size(16, 16), apps[0].icon.size()); | |
375 | |
376 // Check data is cached in local state. | |
377 PrefService* local_state = g_browser_process->local_state(); | |
378 const base::DictionaryValue* dict = | |
379 local_state->GetDictionary(KioskAppManager::kKioskDictionaryName); | |
380 | |
381 std::string name; | |
382 std::string name_key = "apps." + id + ".name"; | |
383 EXPECT_TRUE(dict->GetString(name_key, &name)); | |
384 EXPECT_EQ(apps[0].name, name); | |
385 | |
386 std::string icon_path_string; | |
387 std::string icon_path_key = "apps." + id + ".icon"; | |
388 EXPECT_TRUE(dict->GetString(icon_path_key, &icon_path_string)); | |
389 | |
390 base::FilePath expected_icon_path; | |
391 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); | |
392 expected_icon_path = | |
393 expected_icon_path.AppendASCII(KioskAppManager::kIconCacheDir) | |
394 .AppendASCII(apps[0].app_id) | |
395 .AddExtension(".png"); | |
396 EXPECT_EQ(expected_icon_path.value(), icon_path_string); | |
397 } | |
398 | |
286 KioskAppManager* manager() const { return KioskAppManager::Get(); } | 399 KioskAppManager* manager() const { return KioskAppManager::Get(); } |
400 GURL web_store_url() const { return web_store_url_; } | |
287 | 401 |
288 private: | 402 private: |
289 base::ScopedTempDir temp_dir_; | 403 base::ScopedTempDir temp_dir_; |
404 GURL web_store_url_; | |
290 | 405 |
291 DISALLOW_COPY_AND_ASSIGN(KioskAppManagerTest); | 406 DISALLOW_COPY_AND_ASSIGN(KioskAppManagerTest); |
292 }; | 407 }; |
293 | 408 |
294 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, Basic) { | 409 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, Basic) { |
295 // Add a couple of apps. Use "fake_app_x" that do not have data on the test | 410 // Add a couple of apps. Use "fake_app_x" that do not have data on the test |
296 // server to avoid pending data loads that could be lingering on tear down and | 411 // server to avoid pending data loads that could be lingering on tear down and |
297 // cause DCHECK failure in utility_process_host_impl.cc. | 412 // cause DCHECK failure in utility_process_host_impl.cc. |
298 manager()->AddApp("fake_app_1"); | 413 manager()->AddApp("fake_app_1"); |
299 manager()->AddApp("fake_app_2"); | 414 manager()->AddApp("fake_app_2"); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 EXPECT_TRUE(dict->GetString("apps.app_1.icon", &icon_path_string)); | 554 EXPECT_TRUE(dict->GetString("apps.app_1.icon", &icon_path_string)); |
440 | 555 |
441 base::FilePath expected_icon_path; | 556 base::FilePath expected_icon_path; |
442 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); | 557 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); |
443 expected_icon_path = expected_icon_path. | 558 expected_icon_path = expected_icon_path. |
444 AppendASCII(KioskAppManager::kIconCacheDir). | 559 AppendASCII(KioskAppManager::kIconCacheDir). |
445 AppendASCII(apps[0].app_id).AddExtension(".png"); | 560 AppendASCII(apps[0].app_id).AddExtension(".png"); |
446 EXPECT_EQ(expected_icon_path.value(), icon_path_string); | 561 EXPECT_EQ(expected_icon_path.value(), icon_path_string); |
447 } | 562 } |
448 | 563 |
564 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, DownloadNewApp) { | |
565 base::FilePath crx_path; | |
566 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); | |
567 } | |
568 | |
569 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, RemoveApp) { | |
570 // Add a new app. | |
571 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); | |
572 KioskAppManager::Apps apps; | |
573 manager()->GetApps(&apps); | |
574 ASSERT_EQ(1u, apps.size()); | |
575 base::FilePath crx_path; | |
576 std::string version; | |
577 EXPECT_TRUE(GetKioskAppExtension(kTestLocalFsKioskApp, &crx_path, &version)); | |
578 EXPECT_TRUE(base::PathExists(crx_path)); | |
579 EXPECT_EQ("1.0.0", version); | |
580 | |
581 // Remove the app now. | |
582 manager()->RemoveApp(kTestLocalFsKioskApp); | |
583 manager()->GetApps(&apps); | |
584 ASSERT_EQ(0u, apps.size()); | |
585 EXPECT_FALSE(base::PathExists(crx_path)); | |
586 EXPECT_FALSE(GetKioskAppExtension(kTestLocalFsKioskApp, &crx_path, &version)); | |
587 } | |
588 | |
589 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateApp) { | |
590 // Add a version 1 app first. | |
591 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); | |
592 KioskAppManager::Apps apps; | |
593 manager()->GetApps(&apps); | |
594 ASSERT_EQ(1u, apps.size()); | |
595 base::FilePath crx_path; | |
596 std::string version; | |
597 EXPECT_TRUE(GetKioskAppExtension(kTestLocalFsKioskApp, &crx_path, &version)); | |
598 EXPECT_TRUE(base::PathExists(crx_path)); | |
599 EXPECT_EQ("1.0.0", version); | |
600 | |
601 // Update to version 2. | |
602 SetUpdateCrx(web_store_url(), | |
603 kCrxDownloadPath, | |
604 kTestLocalFsKioskApp, | |
605 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", | |
606 "2.0.0"); | |
607 AppDataLoadWaiter waiter(manager()); | |
608 UpdateAppData(); | |
609 waiter.Wait(); | |
610 EXPECT_TRUE(waiter.loaded()); | |
611 | |
612 // Verify the app has been updated to v2. | |
613 manager()->GetApps(&apps); | |
614 ASSERT_EQ(1u, apps.size()); | |
615 base::FilePath new_crx_path; | |
616 std::string new_version; | |
617 EXPECT_TRUE( | |
618 GetKioskAppExtension(kTestLocalFsKioskApp, &new_crx_path, &new_version)); | |
619 EXPECT_EQ("2.0.0", new_version); | |
620 EXPECT_TRUE(base::PathExists(new_crx_path)); | |
621 // Get original version 2 source download crx file path. | |
622 base::FilePath test_data_dir; | |
623 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
624 base::FilePath v2_file_path = test_data_dir.Append(FILE_PATH_LITERAL( | |
625 "chromeos/app_mode/webstore/downloads/" | |
626 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx")); | |
627 EXPECT_TRUE(base::PathExists(v2_file_path)); | |
628 EXPECT_TRUE(base::ContentsEqual(v2_file_path, new_crx_path)); | |
629 } | |
630 | |
449 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) { | 631 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) { |
450 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status( | 632 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status( |
451 new KioskAppManager::ConsumerKioskAutoLaunchStatus( | 633 new KioskAppManager::ConsumerKioskAutoLaunchStatus( |
452 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED)); | 634 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED)); |
453 scoped_ptr<bool> locked(new bool(false)); | 635 scoped_ptr<bool> locked(new bool(false)); |
454 | 636 |
455 scoped_refptr<content::MessageLoopRunner> runner = | 637 scoped_refptr<content::MessageLoopRunner> runner = |
456 new content::MessageLoopRunner; | 638 new content::MessageLoopRunner; |
457 manager()->GetConsumerKioskAutoLaunchStatus( | 639 manager()->GetConsumerKioskAutoLaunchStatus( |
458 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, | 640 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 manager()->GetConsumerKioskAutoLaunchStatus( | 699 manager()->GetConsumerKioskAutoLaunchStatus( |
518 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, | 700 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, |
519 status.get(), | 701 status.get(), |
520 runner3->QuitClosure())); | 702 runner3->QuitClosure())); |
521 runner3->Run(); | 703 runner3->Run(); |
522 EXPECT_EQ(*status.get(), | 704 EXPECT_EQ(*status.get(), |
523 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); | 705 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); |
524 } | 706 } |
525 | 707 |
526 } // namespace chromeos | 708 } // namespace chromeos |
OLD | NEW |