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

Side by Side Diff: chrome/browser/android/webapk/webapk_installer_unittest.cc

Issue 2528073002: Add a flag in WebAPK's proto when the Web App Manifest is no longer available. (Closed)
Patch Set: Remove best_icon_hash. Created 4 years 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
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 base::Bind(&WebApkInstallerRunner::OnCompleted, 100 base::Bind(&WebApkInstallerRunner::OnCompleted,
101 base::Unretained(this))); 101 base::Unretained(this)));
102 Run(); 102 Run();
103 } 103 }
104 104
105 void RunUpdateWebApk() { 105 void RunUpdateWebApk() {
106 const std::string kIconMurmur2Hash = "0"; 106 const std::string kIconMurmur2Hash = "0";
107 const int kWebApkVersion = 1; 107 const int kWebApkVersion = 1;
108 108
109 WebApkInstaller* installer = CreateWebApkInstaller(); 109 WebApkInstaller* installer = CreateWebApkInstaller();
110 std::map<std::string, std::string> icon_url_hash_map;
111 icon_url_hash_map[best_icon_url_.spec()] = kIconMurmur2Hash;
110 112
111 installer->UpdateAsyncWithURLRequestContextGetter( 113 installer->UpdateAsyncWithURLRequestContextGetter(
112 url_request_context_getter_.get(), 114 url_request_context_getter_.get(),
113 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)), 115 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)),
114 kIconMurmur2Hash,
115 kDownloadedWebApkPackageName, 116 kDownloadedWebApkPackageName,
116 kWebApkVersion); 117 kWebApkVersion,
118 false /* stale_manifest */,
119 icon_url_hash_map);
117 120
118 Run(); 121 Run();
119 } 122 }
120 123
121 WebApkInstaller* CreateWebApkInstaller() { 124 WebApkInstaller* CreateWebApkInstaller() {
122 ShortcutInfo info(GURL::EmptyGURL()); 125 ShortcutInfo info(GURL::EmptyGURL());
123 info.best_icon_url = best_icon_url_; 126 info.best_icon_url = best_icon_url_;
124 127
125 // WebApkInstaller owns itself. 128 // WebApkInstaller owns itself.
126 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); 129 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 runner->RunInstallWebApk(); 327 runner->RunInstallWebApk();
325 EXPECT_FALSE(runner->success()); 328 EXPECT_FALSE(runner->success());
326 } 329 }
327 330
328 // Test update succeeding. 331 // Test update succeeding.
329 TEST_F(WebApkInstallerTest, UpdateSuccess) { 332 TEST_F(WebApkInstallerTest, UpdateSuccess) {
330 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 333 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
331 runner->RunUpdateWebApk(); 334 runner->RunUpdateWebApk();
332 EXPECT_TRUE(runner->success()); 335 EXPECT_TRUE(runner->success());
333 } 336 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698