| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/test/fake_app_instance.h" | 5 #include "components/arc/test/fake_app_instance.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor, | 115 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor, |
| 116 std::vector<uint8_t>(png_data_as_string->begin(), | 116 std::vector<uint8_t>(png_data_as_string->begin(), |
| 117 png_data_as_string->end())); | 117 png_data_as_string->end())); |
| 118 | 118 |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void FakeAppInstance::GenerateAndSendBadIcon(const mojom::AppInfo& app, |
| 123 mojom::ScaleFactor scale_factor) { |
| 124 std::vector<uint8_t> badIcon(10, 1); |
| 125 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor, badIcon); |
| 126 } |
| 127 |
| 122 bool FakeAppInstance::GetFakeIcon(mojom::ScaleFactor scale_factor, | 128 bool FakeAppInstance::GetFakeIcon(mojom::ScaleFactor scale_factor, |
| 123 std::string* png_data_as_string) { | 129 std::string* png_data_as_string) { |
| 124 CHECK(png_data_as_string != nullptr); | 130 CHECK(png_data_as_string != nullptr); |
| 125 std::string icon_file_name; | 131 std::string icon_file_name; |
| 126 switch (scale_factor) { | 132 switch (scale_factor) { |
| 127 case mojom::ScaleFactor::SCALE_FACTOR_100P: | 133 case mojom::ScaleFactor::SCALE_FACTOR_100P: |
| 128 icon_file_name = "icon_100p.png"; | 134 icon_file_name = "icon_100p.png"; |
| 129 break; | 135 break; |
| 130 case mojom::ScaleFactor::SCALE_FACTOR_125P: | 136 case mojom::ScaleFactor::SCALE_FACTOR_125P: |
| 131 icon_file_name = "icon_125p.png"; | 137 icon_file_name = "icon_125p.png"; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 std::string png_data_as_string; | 268 std::string png_data_as_string; |
| 263 if (GetFakeIcon(scale_factor, &png_data_as_string)) { | 269 if (GetFakeIcon(scale_factor, &png_data_as_string)) { |
| 264 callback.Run(std::vector<uint8_t>(png_data_as_string.begin(), | 270 callback.Run(std::vector<uint8_t>(png_data_as_string.begin(), |
| 265 png_data_as_string.end())); | 271 png_data_as_string.end())); |
| 266 } | 272 } |
| 267 } | 273 } |
| 268 | 274 |
| 269 void FakeAppInstance::RemoveCachedIcon(const std::string& icon_resource_id) {} | 275 void FakeAppInstance::RemoveCachedIcon(const std::string& icon_resource_id) {} |
| 270 | 276 |
| 271 } // namespace arc | 277 } // namespace arc |
| OLD | NEW |