| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/webapk/webapk_installer.h" | 5 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 : url_request_context_getter_(new net::TestURLRequestContextGetter( | 71 : url_request_context_getter_(new net::TestURLRequestContextGetter( |
| 72 base::ThreadTaskRunnerHandle::Get())) {} | 72 base::ThreadTaskRunnerHandle::Get())) {} |
| 73 ~WebApkInstallerRunner() {} | 73 ~WebApkInstallerRunner() {} |
| 74 | 74 |
| 75 void Run() { | 75 void Run() { |
| 76 ShortcutInfo info(GURL::EmptyGURL()); | 76 ShortcutInfo info(GURL::EmptyGURL()); |
| 77 | 77 |
| 78 // WebApkInstaller owns itself. | 78 // WebApkInstaller owns itself. |
| 79 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); | 79 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); |
| 80 | 80 |
| 81 installer->SetTimeoutMs(20); | 81 installer->SetTimeoutMs(100); |
| 82 installer->InstallAsyncWithURLRequestContextGetter( | 82 installer->InstallAsyncWithURLRequestContextGetter( |
| 83 url_request_context_getter_.get(), | 83 url_request_context_getter_.get(), |
| 84 base::Bind(&WebApkInstallerRunner::OnCompleted, | 84 base::Bind(&WebApkInstallerRunner::OnCompleted, |
| 85 base::Unretained(this))); | 85 base::Unretained(this))); |
| 86 | 86 |
| 87 base::RunLoop run_loop; | 87 base::RunLoop run_loop; |
| 88 on_completed_callback_ = run_loop.QuitClosure(); | 88 on_completed_callback_ = run_loop.QuitClosure(); |
| 89 run_loop.Run(); | 89 run_loop.Run(); |
| 90 } | 90 } |
| 91 | 91 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 // Test that an HTTP response which cannot be parsed as a webapk::WebApkResponse | 243 // Test that an HTTP response which cannot be parsed as a webapk::WebApkResponse |
| 244 // is handled properly. | 244 // is handled properly. |
| 245 TEST_F(WebApkInstallerTest, UnparsableCreateWebApkResponse) { | 245 TEST_F(WebApkInstallerTest, UnparsableCreateWebApkResponse) { |
| 246 SetWebApkResponseBuilder(base::Bind(&BuildUnparsableWebApkResponse)); | 246 SetWebApkResponseBuilder(base::Bind(&BuildUnparsableWebApkResponse)); |
| 247 | 247 |
| 248 WebApkInstallerRunner runner; | 248 WebApkInstallerRunner runner; |
| 249 runner.Run(); | 249 runner.Run(); |
| 250 EXPECT_FALSE(runner.success()); | 250 EXPECT_FALSE(runner.success()); |
| 251 } | 251 } |
| OLD | NEW |