Commit 09efbc35 authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Extract web_app_icon_test_utils.h helper file.

Let WebAppTest be a pure alias for ChromeRenderViewHostTestHarness.

Bug: 973324
Change-Id: Ia957fbba1fe04c6f6472357c58e5109559d3b8ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724838Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682185}
parent 12468a96
...@@ -91,7 +91,8 @@ source_set("web_applications_test_support") { ...@@ -91,7 +91,8 @@ source_set("web_applications_test_support") {
"test/test_web_app_ui_manager.h", "test/test_web_app_ui_manager.h",
"test/test_web_app_url_loader.cc", "test/test_web_app_url_loader.cc",
"test/test_web_app_url_loader.h", "test/test_web_app_url_loader.h",
"test/web_app_test.cc", "test/web_app_icon_test_utils.cc",
"test/web_app_icon_test_utils.h",
"test/web_app_test.h", "test/web_app_test.h",
] ]
......
...@@ -2,35 +2,23 @@ ...@@ -2,35 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "content/public/test/web_contents_tester.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
namespace web_app { namespace web_app {
WebAppTest::WebAppTest() = default; SkBitmap CreateSquareIcon(int size_px, SkColor solid_color) {
WebAppTest::~WebAppTest() = default;
void WebAppTest::SetUp() {
ChromeRenderViewHostTestHarness::SetUp();
SetContents(CreateTestWebContents());
}
// static
SkBitmap WebAppTest::CreateSquareIcon(int size_px, SkColor solid_color) {
SkBitmap bitmap; SkBitmap bitmap;
bitmap.allocN32Pixels(size_px, size_px); bitmap.allocN32Pixels(size_px, size_px);
bitmap.eraseColor(solid_color); bitmap.eraseColor(solid_color);
return bitmap; return bitmap;
} }
// static WebApplicationInfo::IconInfo GenerateIconInfo(const GURL& url,
WebApplicationInfo::IconInfo WebAppTest::GenerateIconInfo(const GURL& url,
int size_px, int size_px,
SkColor solid_color) { SkColor solid_color) {
WebApplicationInfo::IconInfo icon_info; WebApplicationInfo::IconInfo icon_info;
...@@ -42,8 +30,7 @@ WebApplicationInfo::IconInfo WebAppTest::GenerateIconInfo(const GURL& url, ...@@ -42,8 +30,7 @@ WebApplicationInfo::IconInfo WebAppTest::GenerateIconInfo(const GURL& url,
return icon_info; return icon_info;
} }
// static void AddIconToIconsMap(const GURL& icon_url,
void WebAppTest::AddIconToIconsMap(const GURL& icon_url,
int size_px, int size_px,
SkColor solid_color, SkColor solid_color,
IconsMap* icons_map) { IconsMap* icons_map) {
......
// Copyright (c) 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_ICON_TEST_UTILS_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_ICON_TEST_UTILS_H_
#include "chrome/browser/web_applications/components/web_app_install_utils.h"
#include "chrome/common/web_application_info.h"
#include "third_party/skia/include/core/SkColor.h"
class GURL;
class SkBitmap;
namespace web_app {
SkBitmap CreateSquareIcon(int size_px, SkColor solid_color);
WebApplicationInfo::IconInfo GenerateIconInfo(const GURL& url,
int size_px,
SkColor solid_color);
void AddIconToIconsMap(const GURL& icon_url,
int size_px,
SkColor solid_color,
IconsMap* icons_map);
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_ICON_TEST_UTILS_H_
...@@ -5,39 +5,10 @@ ...@@ -5,39 +5,10 @@
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_
#include "base/macros.h"
#include "chrome/browser/web_applications/components/web_app_install_utils.h"
#include "chrome/common/web_application_info.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "third_party/skia/include/core/SkColor.h"
class GURL; // Consider to implement web app specific test harness independent of
class SkBitmap; // RenderViewHost.
using WebAppTest = ChromeRenderViewHostTestHarness;
namespace web_app {
class WebAppTest : public ChromeRenderViewHostTestHarness {
public:
WebAppTest();
~WebAppTest() override;
void SetUp() override;
static SkBitmap CreateSquareIcon(int size_px, SkColor solid_color);
static WebApplicationInfo::IconInfo GenerateIconInfo(const GURL& url,
int size_px,
SkColor solid_color);
static void AddIconToIconsMap(const GURL& icon_url,
int size_px,
SkColor solid_color,
IconsMap* icons_map);
private:
DISALLOW_COPY_AND_ASSIGN(WebAppTest);
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_ #endif // CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_H_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "chrome/browser/web_applications/components/web_app_icon_generator.h" #include "chrome/browser/web_applications/components/web_app_icon_generator.h"
#include "chrome/browser/web_applications/test/test_file_utils.h" #include "chrome/browser/web_applications/test/test_file_utils.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "chrome/browser/web_applications/test/test_data_retriever.h" #include "chrome/browser/web_applications/test/test_data_retriever.h"
#include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "chrome/browser/web_applications/test/test_install_finalizer.h"
#include "chrome/browser/web_applications/test/test_web_app_url_loader.h" #include "chrome/browser/web_applications/test/test_web_app_url_loader.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "chrome/browser/web_applications/test/test_file_utils.h" #include "chrome/browser/web_applications/test/test_file_utils.h"
#include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "chrome/browser/web_applications/test/test_install_finalizer.h"
#include "chrome/browser/web_applications/test/test_web_app_database.h" #include "chrome/browser/web_applications/test/test_web_app_database.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_icon_manager.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment