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

Unified Diff: chrome/browser/extensions/bookmark_app_helper_unittest.cc

Issue 229553003: Implement syncing of bookmark apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/bookmark_app_helper_unittest.cc
diff --git a/chrome/browser/extensions/bookmark_app_helper_unittest.cc b/chrome/browser/extensions/bookmark_app_helper_unittest.cc
index 4c4ef21cd531f294ec01930cc8d3d285e224c3f5..0c8ab1f92352bfd0bbc2a69e0ae098122b13d678 100644
--- a/chrome/browser/extensions/bookmark_app_helper_unittest.cc
+++ b/chrome/browser/extensions/bookmark_app_helper_unittest.cc
@@ -13,6 +13,7 @@
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/skia_util.h"
namespace {
@@ -75,6 +76,23 @@ WebApplicationInfo::IconInfo CreateIconInfoWithBitmap(int size, SkColor color) {
icon_info.data = CreateSquareBitmapWithColor(size, color);
return icon_info;
}
+
+void ValidateWebApplicationInfo(base::Closure callback,
+ const WebApplicationInfo& expected,
+ const WebApplicationInfo& actual) {
+ EXPECT_EQ(expected.title, actual.title);
+ EXPECT_EQ(expected.description, actual.description);
+ EXPECT_EQ(expected.app_url, actual.app_url);
+ EXPECT_EQ(expected.icons.size(), actual.icons.size());
+ for (size_t i = 0; i < expected.icons.size(); ++i) {
+ EXPECT_EQ(expected.icons[i].width, actual.icons[i].width);
+ EXPECT_EQ(expected.icons[i].height, actual.icons[i].height);
+ EXPECT_EQ(expected.icons[i].url, actual.icons[i].url);
+ EXPECT_TRUE(
+ gfx::BitmapsAreEqual(expected.icons[i].data, actual.icons[i].data));
+ }
+ callback.Run();
+}
#endif
} // namespace
@@ -186,6 +204,30 @@ TEST_F(BookmarkAppHelperExtensionServiceTest, CreateAndUpdateBookmarkApp) {
.empty());
}
}
+
+TEST_F(BookmarkAppHelperExtensionServiceTest, GetWebApplicationInfo) {
+ WebApplicationInfo web_app_info;
+ web_app_info.app_url = GURL(kAppUrl);
+ web_app_info.title = base::UTF8ToUTF16(kAppTitle);
+ web_app_info.description = base::UTF8ToUTF16(kAppDescription);
+
+ web_app_info.icons.push_back(
+ CreateIconInfoWithBitmap(kIconSizeSmall, SK_ColorRED));
+ web_app_info.icons.push_back(
+ CreateIconInfoWithBitmap(kIconSizeLarge, SK_ColorRED));
+
+ extensions::CreateOrUpdateBookmarkApp(service_, web_app_info);
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(1u, registry_->enabled_extensions().size());
+ base::RunLoop run_loop;
+ extensions::GetWebApplicationInfoFromApp(
+ profile_.get(),
+ service_->extensions()->begin()->get(),
+ base::Bind(
+ &ValidateWebApplicationInfo, run_loop.QuitClosure(), web_app_info));
+ run_loop.Run();
+}
#endif
TEST_F(BookmarkAppHelperTest, ConstrainBitmapsToSizes) {
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper.cc ('k') | chrome/browser/extensions/extension_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698