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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 void Run() { | 128 void Run() { |
129 base::RunLoop run_loop; | 129 base::RunLoop run_loop; |
130 on_completed_callback_ = run_loop.QuitClosure(); | 130 on_completed_callback_ = run_loop.QuitClosure(); |
131 run_loop.Run(); | 131 run_loop.Run(); |
132 } | 132 } |
133 | 133 |
134 bool success() { return success_; } | 134 bool success() { return success_; } |
135 | 135 |
136 private: | 136 private: |
137 void OnCompleted(bool success) { | 137 void OnCompleted(bool success, const std::string& webapk_package) { |
138 success_ = success; | 138 success_ = success; |
139 on_completed_callback_.Run(); | 139 on_completed_callback_.Run(); |
140 } | 140 } |
141 | 141 |
142 scoped_refptr<net::TestURLRequestContextGetter> | 142 scoped_refptr<net::TestURLRequestContextGetter> |
143 url_request_context_getter_; | 143 url_request_context_getter_; |
144 | 144 |
145 // The Web Manifest's icon URL. | 145 // The Web Manifest's icon URL. |
146 const GURL icon_url_; | 146 const GURL icon_url_; |
147 | 147 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 runner->RunInstallWebApk(); | 333 runner->RunInstallWebApk(); |
334 EXPECT_FALSE(runner->success()); | 334 EXPECT_FALSE(runner->success()); |
335 } | 335 } |
336 | 336 |
337 // Test update succeeding. | 337 // Test update succeeding. |
338 TEST_F(WebApkInstallerTest, UpdateSuccess) { | 338 TEST_F(WebApkInstallerTest, UpdateSuccess) { |
339 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); | 339 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); |
340 runner->RunUpdateWebApk(); | 340 runner->RunUpdateWebApk(); |
341 EXPECT_TRUE(runner->success()); | 341 EXPECT_TRUE(runner->success()); |
342 } | 342 } |
OLD | NEW |