Commit 60bb2e91 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Revert "Make CQ run vr_common_unittests on Windows"

This reverts commit 95ae7232.

Reason for revert: Breaking windows compile, e.g. https://build.chromium.org/p/chromium/builders/Win/builds/59641

Original change's description:
> Make CQ run vr_common_unittests on Windows
> 
> There were a few clang-specific C++ extensions in use, and some warnings that hit only on MSVC.
> gltf tests had to be disabled because url->path parsing is not correct on Windows.
> 
> BUG=744675
> 
> Change-Id: Ica976477da4b5009a68d738e71ee995af871d1f7
> Reviewed-on: https://chromium-review.googlesource.com/695807
> Commit-Queue: Bill Orr <billorr@chromium.org>
> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> Reviewed-by: Christopher Grant <cjgrant@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#506866}

TBR=cjgrant@chromium.org,bsheedy@chromium.org,billorr@google.com,jochen@chromium.org,billorr@chromium.org

Change-Id: I0047a3d865fc7ee4eadc9bbaf1ff5942366daa53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 744675
Reviewed-on: https://chromium-review.googlesource.com/704056Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506937}
parent 1d130aa1
......@@ -13,7 +13,7 @@ if (is_android) {
assert(enable_vr)
source_set("vr_common_source") {
static_library("vr_common") {
sources = [
"animation_player.cc",
"animation_player.h",
......@@ -156,28 +156,6 @@ source_set("vr_common_source") {
]
}
static_library("vr_common") {
deps = [
":vr_common_source",
"//base",
"//cc/animation",
"//cc/paint",
"//chrome/app:generated_resources",
"//chrome/browser/resources:vr_shell_resources",
"//components/security_state/core",
"//components/strings",
"//components/toolbar",
"//components/url_formatter",
"//components/vector_icons",
"//components/vector_icons",
"//skia",
"//ui/base",
"//ui/display",
"//ui/gl",
"//ui/gl/init",
]
}
test("vr_common_unittests") {
sources = [
"animation_player_unittest.cc",
......@@ -219,13 +197,8 @@ test("vr_common_unittests") {
"vr_gl_util_unittest.cc",
]
# TODO(mthiesse, crbug.com/769373): The dependency on device/vr:fakes requires
# some workarounds for tests, since we are static-linking to the fakes instead
# of loading them from a dll on Windows.
defines = [ "DEVICE_VR_IMPLEMENTATION" ]
deps = [
":vr_common_source",
":vr_common",
":vr_test_pak",
"//base/test:test_support",
"//components/security_state/core",
......@@ -246,11 +219,6 @@ test("vr_common_unittests") {
"//ui/gl:test_support",
]
if (is_win) {
# TODO(crbug/770891): Fix GLTF parsing on Windows and reenable the test.
sources -= [ "gltf_parser_unittest.cc" ]
}
if (is_android) {
deps += [ "//ui/android:ui_java" ]
}
......
......@@ -20,7 +20,7 @@ namespace vr {
namespace {
static constexpr float kTolerance = 1e-5f;
static constexpr float kTolerance = 1e-5;
static int s_next_animation_id = 1;
static int s_next_group_id = 1;
......
......@@ -16,7 +16,7 @@
namespace vr {
static constexpr float kNoise = 1e-6f;
static constexpr float kNoise = 1e-6;
class TestAnimationTarget : public cc::AnimationTarget {
public:
......
......@@ -17,11 +17,11 @@ namespace vr {
namespace {
constexpr float kHeight = 0.064f;
constexpr float kWidthHeightRatio = 16.0f;
constexpr float kFontHeight = 0.024f;
constexpr float kWidthPadding = 0.02f;
constexpr float kCornerRadius = 0.004f;
constexpr float kHeight = 0.064;
constexpr float kWidthHeightRatio = 16.0;
constexpr float kFontHeight = 0.024;
constexpr float kWidthPadding = 0.02;
constexpr float kCornerRadius = 0.004;
} // namespace
......
......@@ -19,15 +19,15 @@ namespace vr {
namespace {
constexpr float kWidth = 0.672f;
constexpr float kHeight = 0.2f;
constexpr float kButtonWidth = 0.162f;
constexpr float kButtonHeight = 0.066f;
constexpr float kPromptTextButtonSeperatorHeight = 0.04f;
constexpr float kButtonsSeperatorWidth = 0.01f;
constexpr float kButtonRadiusFactor = 0.006f;
constexpr float kFontSizePromptText = 0.027f;
constexpr float kFontSizePromptButtonText = 0.024f;
constexpr float kWidth = 0.672;
constexpr float kHeight = 0.2;
constexpr float kButtonWidth = 0.162;
constexpr float kButtonHeight = 0.066;
constexpr float kPromptTextButtonSeperatorHeight = 0.04;
constexpr float kButtonsSeperatorWidth = 0.01;
constexpr float kButtonRadiusFactor = 0.006;
constexpr float kFontSizePromptText = 0.027;
constexpr float kFontSizePromptButtonText = 0.024;
} // namespace
......
......@@ -20,9 +20,9 @@ namespace vr {
namespace {
constexpr float kBorderFactor = 0.045f;
constexpr float kFontSizeFactor = 0.048f;
constexpr float kTextWidthFactor = 1.0f - 3 * kBorderFactor;
constexpr float kBorderFactor = 0.045;
constexpr float kFontSizeFactor = 0.048;
constexpr float kTextWidthFactor = 1.0 - 3 * kBorderFactor;
} // namespace
......
......@@ -17,10 +17,10 @@ namespace vr {
namespace {
constexpr int kHeightWidthRatio = 8;
constexpr float kBorderFactor = 0.1f;
constexpr float kIconSizeFactor = 0.7f;
constexpr float kFontSizeFactor = 0.40f;
constexpr int kHeightWidthRatio = 8.0;
constexpr float kBorderFactor = 0.1;
constexpr float kIconSizeFactor = 0.7;
constexpr float kFontSizeFactor = 0.40;
} // namespace
......
......@@ -18,7 +18,7 @@ static bool g_initialized_for_testing_ = false;
}
TexturedElement::TexturedElement(int maximum_width)
: texture_handle_(unsigned(-1)), maximum_width_(maximum_width) {}
: texture_handle_(-1), maximum_width_(maximum_width) {}
TexturedElement::~TexturedElement() = default;
......
......@@ -11,7 +11,6 @@
#include "base/stl_util.h"
#include "base/time/time.h"
#include "chrome/browser/vr/elements/ui_element_transform_operations.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
#include "ui/gfx/geometry/angle_conversions.h"
namespace vr {
......@@ -336,9 +335,6 @@ void UiElement::LayOutChildren() {
case XNONE:
x_offset = 0.0f;
break;
default:
NOTREACHED();
return;
}
float y_offset;
switch (child->y_anchoring()) {
......@@ -351,9 +347,6 @@ void UiElement::LayOutChildren() {
case YNONE:
y_offset = 0.0f;
break;
default:
NOTREACHED();
return;
}
child->SetLayoutOffset(x_offset, y_offset);
}
......
......@@ -25,17 +25,17 @@ namespace vr {
namespace {
static constexpr float kWidth = 0.672f;
static constexpr float kHeight = 0.088f;
static constexpr float kFontHeight = 0.027f;
static constexpr float kWidth = 0.672;
static constexpr float kHeight = 0.088;
static constexpr float kFontHeight = 0.027;
static constexpr float kBackButtonWidth = kHeight;
static constexpr float kBackIconSize = 0.0375f;
static constexpr float kBackIconOffset = 0.005f;
static constexpr float kFieldSpacing = 0.014f;
static constexpr float kSecurityIconSize = 0.03f;
static constexpr float kUrlRightMargin = 0.02f;
static constexpr float kSeparatorWidth = 0.002f;
static constexpr float kChipTextLineMargin = kHeight * 0.3f;
static constexpr float kBackIconSize = 0.0375;
static constexpr float kBackIconOffset = 0.005;
static constexpr float kFieldSpacing = 0.014;
static constexpr float kSecurityIconSize = 0.03;
static constexpr float kUrlRightMargin = 0.02;
static constexpr float kSeparatorWidth = 0.002;
static constexpr float kChipTextLineMargin = kHeight * 0.3;
static constexpr SkScalar kStrikeThicknessFactor = (SK_Scalar1 / 9);
using security_state::SecurityLevel;
......
......@@ -152,9 +152,8 @@ class UrlEmphasisTest : public testing::Test {
MockRenderText mock_;
};
#if !defined(OS_LINUX) && !defined(OS_WIN)
#if !defined(OS_LINUX)
// TODO(crbug/731894): This test does not work on Linux.
// TODO(crbug/770893): This test does not work on Windows.
TEST(UrlBarTextureTest, WillNotFailOnNonAsciiURLs) {
TestUrlBarTexture texture;
EXPECT_EQ(3lu, texture.GetNumberOfFontFallbacksForURL(
......
......@@ -16,8 +16,7 @@ void DrawVectorIcon(gfx::Canvas* canvas,
const gfx::PointF& corner,
SkColor color) {
gfx::ScopedCanvas scoped(canvas);
canvas->Translate(
{static_cast<int>(corner.x()), static_cast<int>(corner.y())});
canvas->Translate({corner.x(), corner.y()});
// Explicitly cut out the 1x version of the icon, as PaintVectorIcon draws the
// 1x version if device scale factor isn't set. See crbug.com/749146.
......
......@@ -148,10 +148,10 @@ TEST_F(ViewportAwareRootTest, TestAdjustRotationForHeadPose) {
CheckRotateClockwiseAndReverse(gfx::Vector3dF{0.f, 0.f, -1.f});
CheckRotateClockwiseAndReverse(
gfx::Vector3dF{0.f, std::sin(1.0f), -std::cos(1.0f)});
gfx::Vector3dF{0.f, std::sin(1), -std::cos(1)});
CheckRotateClockwiseAndReverse(
gfx::Vector3dF{0.f, -std::sin(1.5f), -std::cos(1.5f)});
gfx::Vector3dF{0.f, -std::sin(1.5), -std::cos(1.5)});
}
TEST_F(ViewportAwareRootTest, ChildElementsRepositioned) {
......
......@@ -19,14 +19,14 @@ namespace vr {
namespace {
static constexpr float kWidth = 0.472f;
static constexpr float kHeight = 0.064f;
static constexpr float kFontHeight = 0.027f;
static constexpr float kSecurityIconOffsetLeft = 0.022f;
static constexpr float kSecurityIconOffsetRight = 0.016f;
static constexpr float kSecurityIconSize = 0.03f;
static constexpr float kUrlRightMargin = 0.02f;
static constexpr float kRadius = 0.004f;
static constexpr float kWidth = 0.472;
static constexpr float kHeight = 0.064;
static constexpr float kFontHeight = 0.027;
static constexpr float kSecurityIconOffsetLeft = 0.022;
static constexpr float kSecurityIconOffsetRight = 0.016;
static constexpr float kSecurityIconSize = 0.03;
static constexpr float kUrlRightMargin = 0.02;
static constexpr float kRadius = 0.004;
} // namespace
......
......@@ -11,7 +11,6 @@
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "third_party/icu/source/common/unicode/uscript.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkTypeface.h"
......@@ -49,7 +48,7 @@ class CachedFont {
uint16_t glyph_id;
paint_.textToGlyphs(&character, sizeof(UChar32), &glyph_id);
supported = glyph_id ? KNOWN : UNKNOWN;
return supported == KNOWN;
return glyph_id;
}
std::string GetFontName() { return name_; }
......@@ -127,9 +126,6 @@ base::LazyInstance<CachedFontSet>::Leaky g_cached_font_set =
LAZY_INSTANCE_INITIALIZER;
bool FontSupportsChar(const gfx::Font& font, UChar32 c) {
#if defined(OS_WIN)
return true; // TODO(crbug/770893): Implement this on Windows.
#else
sk_sp<SkTypeface> typeface =
static_cast<gfx::PlatformFontLinux*>(font.platform_font())->typeface();
std::unique_ptr<CachedFont>& cached_font =
......@@ -137,7 +133,6 @@ bool FontSupportsChar(const gfx::Font& font, UChar32 c) {
if (!cached_font)
cached_font = CachedFont::CreateForTypeface(std::move(typeface));
return cached_font->HasGlyphForCharacter(c);
#endif
}
} // namespace
......
......@@ -14,13 +14,10 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/sys_byteorder.h"
#include "build/build_config.h"
#include "net/base/data_url.h"
#include "net/base/filename_util.h"
#include "url/gurl.h"
#include <codecvt>
namespace vr {
namespace {
......@@ -163,17 +160,7 @@ std::unique_ptr<gltf::Buffer> GltfParser::ProcessUri(
}
if (uri.SchemeIsFile()) {
auto data = base::MakeUnique<gltf::Buffer>();
base::FilePath path;
#if defined(OS_WIN)
// Windows uses UTF-16 for file paths, so we need to convert.
path = base::FilePath(
// presubmit: allow wstring
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>{}
.from_bytes(uri.path()));
#else
path = base::FilePath(uri.path());
#endif
if (!base::ReadFileToString(path, data.get()))
if (!base::ReadFileToString(base::FilePath(uri.path()), data.get()))
return nullptr;
return data;
}
......
......@@ -45,8 +45,7 @@ std::unique_ptr<base::DictionaryValue> GltfParserTest::Deserialize(
}
TEST_F(GltfParserTest, Parse) {
auto asset =
Deserialize(data_dir_.Append(FILE_PATH_LITERAL("sample_inline.gltf")));
auto asset = Deserialize(data_dir_.Append("sample_inline.gltf"));
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
......@@ -110,8 +109,7 @@ TEST_F(GltfParserTest, Parse) {
}
TEST_F(GltfParserTest, ParseUnknownBuffer) {
auto asset =
Deserialize(data_dir_.Append(FILE_PATH_LITERAL("sample_inline.gltf")));
auto asset = Deserialize(data_dir_.Append("sample_inline.gltf"));
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
......@@ -129,8 +127,7 @@ TEST_F(GltfParserTest, ParseUnknownBuffer) {
}
TEST_F(GltfParserTest, ParseMissingRequired) {
auto asset =
Deserialize(data_dir_.Append(FILE_PATH_LITERAL("sample_inline.gltf")));
auto asset = Deserialize(data_dir_.Append("sample_inline.gltf"));
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
......@@ -140,7 +137,7 @@ TEST_F(GltfParserTest, ParseMissingRequired) {
}
TEST_F(GltfParserTest, ParseExternal) {
auto gltf_path = data_dir_.Append(FILE_PATH_LITERAL("sample_external.gltf"));
auto gltf_path = data_dir_.Append("sample_external.gltf");
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
......@@ -154,8 +151,7 @@ TEST_F(GltfParserTest, ParseExternal) {
}
TEST_F(GltfParserTest, ParseExternalNoPath) {
auto asset =
Deserialize(data_dir_.Append(FILE_PATH_LITERAL("sample_external.gltf")));
auto asset = Deserialize(data_dir_.Append("sample_external.gltf"));
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
......@@ -165,8 +161,7 @@ TEST_F(GltfParserTest, ParseExternalNoPath) {
TEST_F(BinaryGltfParserTest, ParseBinary) {
std::string data;
EXPECT_TRUE(base::ReadFileToString(
data_dir_.Append(FILE_PATH_LITERAL("sample.glb")), &data));
EXPECT_TRUE(base::ReadFileToString(data_dir_.Append("sample.glb"), &data));
base::StringPiece glb_data(data);
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
std::unique_ptr<gltf::Asset> asset =
......
......@@ -3,10 +3,9 @@
// found in the LICENSE file.
#include "chrome/browser/vr/test/gl_test_environment.h"
#include "ui/gl/gl_version_info.h"
#include "ui/gl/init/gl_factory.h"
#include "ui/gl/test/gl_image_test_support.h"
#include "ui/gl/test/gl_test_helper.h"
#include "ui/gl/test/gl_image_test_template.h"
#include "ui/gl/test/gl_surface_test_support.h"
namespace vr {
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/browser/vr/test/gl_test_environment.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
......@@ -11,13 +10,9 @@
namespace vr {
TEST(GlTestEnvironmentTest, InitializeAndCleanup) {
// TODO(crbug/771794): Test temporarily disabled on Windows because it crashes
// on trybots. Fix before enabling Windows support.
#ifndef OS_WIN
GlTestEnvironment gl_test_environment(gfx::Size(100, 100));
EXPECT_NE(gl_test_environment.GetFrameBufferForTesting(), 0u);
EXPECT_EQ(glGetError(), (GLenum)GL_NO_ERROR);
#endif
// We just test that clean up doesn't crash.
}
......
......@@ -8,7 +8,6 @@
#include "base/macros.h"
#include "chrome/browser/vr/content_input_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
namespace vr {
......
......@@ -5,7 +5,6 @@
#include "chrome/browser/vr/test/ui_pixel_test.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/vr/browser_ui_interface.h"
#include "chrome/browser/vr/ui_browser_interface.h"
#include "chrome/browser/vr/ui_input_manager.h"
......@@ -16,7 +15,7 @@
#include "third_party/skia/include/core/SkStream.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/test/gl_test_helper.h"
#include "ui/gl/test/gl_image_test_template.h"
namespace vr {
......@@ -32,9 +31,6 @@ UiPixelTest::UiPixelTest() : frame_buffer_size_(kPixelHalfScreen) {}
UiPixelTest::~UiPixelTest() = default;
void UiPixelTest::SetUp() {
// TODO(crbug/771794): Test temporarily disabled on Windows because it crashes
// on trybots. Fix before enabling Windows support.
#ifndef OS_WIN
gl_test_environment_ =
base::MakeUnique<GlTestEnvironment>(frame_buffer_size_);
......@@ -46,17 +42,12 @@ void UiPixelTest::SetUp() {
browser_ = base::MakeUnique<MockBrowserInterface>();
content_input_delegate_ = base::MakeUnique<MockContentInputDelegate>();
#endif
}
void UiPixelTest::TearDown() {
// TODO(crbug/771794): Test temporarily disabled on Windows because it crashes
// on trybots. Fix before enabling Windows support.
#ifndef OS_WIN
ui_.reset();
glDeleteTextures(1, &content_texture_);
gl_test_environment_.reset();
#endif
}
void UiPixelTest::MakeUi(const UiInitialState& ui_initial_state,
......
......@@ -12,7 +12,6 @@
#include "chrome/browser/vr/ui.h"
#include "chrome/browser/vr/ui_scene.h"
#include "chrome/browser/vr/ui_scene_manager.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
#include "ui/gfx/geometry/vector3d_f.h"
namespace vr {
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/vr/test/constants.h"
#include "chrome/browser/vr/test/ui_pixel_test.h"
#include "chrome/browser/vr/toolbar_state.h"
......@@ -19,9 +18,6 @@ static const gfx::Transform kIdentity;
} // namespace
TEST_F(UiPixelTest, DrawVrBrowsingMode) {
// TODO(crbug/771794): Test temporarily disabled on Windows because it crashes
// on trybots. Fix before enabling Windows support.
#ifndef OS_WIN
// Set up scene.
UiInitialState ui_initial_state;
ui_initial_state.in_cct = false;
......@@ -40,7 +36,6 @@ TEST_F(UiPixelTest, DrawVrBrowsingMode) {
// Read pixels into SkBitmap.
auto bitmap = SaveCurrentFrameBufferToSkBitmap();
EXPECT_TRUE(bitmap);
#endif
}
} // namespace vr
......@@ -4,7 +4,6 @@
#include "chrome/browser/vr/ui_renderer.h"
#include "base/numerics/math_constants.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/vr/elements/ui_element.h"
#include "chrome/browser/vr/ui_scene.h"
......@@ -253,8 +252,7 @@ void UiRenderer::DrawLaser(const gfx::Transform& render_matrix,
mat.matrix().postScale(kLaserWidth, laser_length, 1);
// Tip back 90 degrees to flat, pointing at the scene.
const gfx::Quaternion quat(gfx::Vector3dF(1.0f, 0.0f, 0.0f),
-base::kPiDouble / 2);
const gfx::Quaternion quat(gfx::Vector3dF(1.0f, 0.0f, 0.0f), -M_PI / 2);
gfx::Transform rotation_mat(quat);
mat = rotation_mat * mat;
......@@ -270,7 +268,7 @@ void UiRenderer::DrawLaser(const gfx::Transform& render_matrix,
gfx::Transform transform;
for (int i = 0; i < faces; i++) {
// Rotate around Z.
const float angle = base::kPiFloat * 2 * i / faces;
const float angle = M_PI * 2 * i / faces;
const gfx::Quaternion rot({0.0f, 0.0f, 1.0f}, angle);
face_transform = beam_direction_mat * gfx::Transform(rot) * mat;
......
......@@ -5,99 +5,97 @@
#ifndef CHROME_BROWSER_VR_UI_SCENE_CONSTANTS_H_
#define CHROME_BROWSER_VR_UI_SCENE_CONSTANTS_H_
#include "base/numerics/math_constants.h"
namespace vr {
static constexpr int kWarningTimeoutSeconds = 30;
static constexpr float kWarningDistance = 1.0;
static constexpr float kWarningAngleRadians = 16.3f * base::kPiFloat / 180;
static constexpr float kWarningAngleRadians = 16.3 * M_PI / 180.0;
static constexpr float kPermanentWarningHeightDMM = 0.049f;
static constexpr float kPermanentWarningWidthDMM = 0.1568f;
static constexpr float kTransientWarningHeightDMM = 0.160f;
static constexpr float kTransientWarningWidthDMM = 0.512f;
static constexpr float kTransientWarningHeightDMM = 0.160;
static constexpr float kTransientWarningWidthDMM = 0.512;
static constexpr float kExitWarningDistance = 0.6f;
static constexpr float kExitWarningHeight = 0.160f;
static constexpr float kExitWarningWidth = 0.512f;
static constexpr float kExitWarningDistance = 0.6;
static constexpr float kExitWarningHeight = 0.160;
static constexpr float kExitWarningWidth = 0.512;
static constexpr float kContentDistance = 2.5;
static constexpr float kContentWidth = 0.96f * kContentDistance;
static constexpr float kContentHeight = 0.64f * kContentDistance;
static constexpr float kContentVerticalOffset = -0.1f * kContentDistance;
static constexpr float kContentCornerRadius = 0.005f * kContentWidth;
static constexpr float kContentWidth = 0.96 * kContentDistance;
static constexpr float kContentHeight = 0.64 * kContentDistance;
static constexpr float kContentVerticalOffset = -0.1 * kContentDistance;
static constexpr float kContentCornerRadius = 0.005 * kContentWidth;
static constexpr float kBackplaneSize = 1000.0;
static constexpr float kBackgroundDistanceMultiplier = 1.414f;
static constexpr float kBackgroundDistanceMultiplier = 1.414;
static constexpr float kFullscreenDistance = 3;
// Make sure that the aspect ratio for fullscreen is 16:9. Otherwise, we may
// experience visual artefacts for fullscreened videos.
static constexpr float kFullscreenHeight = 0.64f * kFullscreenDistance;
static constexpr float kFullscreenWidth = 1.138f * kFullscreenDistance;
static constexpr float kFullscreenVerticalOffset = -0.1f * kFullscreenDistance;
static constexpr float kFullscreenHeight = 0.64 * kFullscreenDistance;
static constexpr float kFullscreenWidth = 1.138 * kFullscreenDistance;
static constexpr float kFullscreenVerticalOffset = -0.1 * kFullscreenDistance;
static constexpr float kExitPromptWidth = 0.672f * kContentDistance;
static constexpr float kExitPromptHeight = 0.2f * kContentDistance;
static constexpr float kExitPromptVerticalOffset = -0.09f * kContentDistance;
static constexpr float kExitPromptWidth = 0.672 * kContentDistance;
static constexpr float kExitPromptHeight = 0.2 * kContentDistance;
static constexpr float kExitPromptVerticalOffset = -0.09 * kContentDistance;
static constexpr float kExitPromptBackplaneSize = 1000.0;
// Distance-independent milimeter size of the URL bar.
static constexpr float kUrlBarWidthDMM = 0.672f;
static constexpr float kUrlBarHeightDMM = 0.088f;
static constexpr float kUrlBarDistance = 2.4f;
static constexpr float kUrlBarWidthDMM = 0.672;
static constexpr float kUrlBarHeightDMM = 0.088;
static constexpr float kUrlBarDistance = 2.4;
static constexpr float kUrlBarWidth = kUrlBarWidthDMM * kUrlBarDistance;
static constexpr float kUrlBarHeight = kUrlBarHeightDMM * kUrlBarDistance;
static constexpr float kUrlBarVerticalOffset = -0.516f * kUrlBarDistance;
static constexpr float kUrlBarRotationRad = -0.175f;
static constexpr float kUrlBarVerticalOffset = -0.516 * kUrlBarDistance;
static constexpr float kUrlBarRotationRad = -0.175;
static constexpr float kIndicatorHeight = 0.08f;
static constexpr float kIndicatorGap = 0.05f;
static constexpr float kIndicatorVerticalOffset = 0.1f;
static constexpr float kIndicatorDistanceOffset = 0.1f;
static constexpr float kIndicatorHeight = 0.08;
static constexpr float kIndicatorGap = 0.05;
static constexpr float kIndicatorVerticalOffset = 0.1;
static constexpr float kIndicatorDistanceOffset = 0.1;
static constexpr float kWebVrUrlToastWidthDMM = 0.472f;
static constexpr float kWebVrUrlToastHeightDMM = 0.064f;
static constexpr float kWebVrUrlToastWidthDMM = 0.472;
static constexpr float kWebVrUrlToastHeightDMM = 0.064;
static constexpr float kWebVrUrlToastDistance = 1.0;
static constexpr float kWebVrUrlToastWidth =
kWebVrUrlToastWidthDMM * kWebVrUrlToastDistance;
static constexpr float kWebVrUrlToastHeight =
kWebVrUrlToastHeightDMM * kWebVrUrlToastDistance;
static constexpr int kWebVrUrlToastTimeoutSeconds = 6;
static constexpr float kWebVrUrlToastRotationRad = 14 * base::kPiFloat / 180;
static constexpr float kWebVrUrlToastRotationRad = 14 * M_PI / 180.0;
static constexpr float kWebVrToastDistance = 1.0;
static constexpr float kFullscreenToastDistance = kFullscreenDistance;
static constexpr float kToastWidthDMM = 0.512f;
static constexpr float kToastHeightDMM = 0.064f;
static constexpr float kToastOffsetDMM = 0.004f;
static constexpr float kToastWidthDMM = 0.512;
static constexpr float kToastHeightDMM = 0.064;
static constexpr float kToastOffsetDMM = 0.004;
// When changing the value here, make sure it doesn't collide with
// kWarningAngleRadians.
static constexpr float kWebVrAngleRadians = 9.88f * base::kPiFloat / 180;
static constexpr float kWebVrAngleRadians = 9.88 * M_PI / 180.0;
static constexpr int kToastTimeoutSeconds = kWebVrUrlToastTimeoutSeconds;
static constexpr float kSplashScreenTextDistance = 2.5f;
static constexpr float kSplashScreenTextDistance = 2.5;
static constexpr float kSplashScreenTextFontHeightM =
0.05f * kSplashScreenTextDistance;
static constexpr float kSplashScreenTextWidthM =
0.9f * kSplashScreenTextDistance;
static constexpr float kSplashScreenTextHeightM =
0.08f * kSplashScreenTextDistance;
static constexpr float kSplashScreenTextVerticalOffset = -0.18f;
static constexpr float kSplashScreenTextVerticalOffset = -0.18;
static constexpr float kSplashScreenMinDurationSeconds = 3;
static constexpr float kCloseButtonDistance = 2.4f;
static constexpr float kCloseButtonDistance = 2.4;
static constexpr float kCloseButtonHeight =
kUrlBarHeightDMM * kCloseButtonDistance;
static constexpr float kCloseButtonWidth =
kUrlBarHeightDMM * kCloseButtonDistance;
static constexpr float kCloseButtonFullscreenDistance = 2.9f;
static constexpr float kCloseButtonFullscreenDistance = 2.9;
static constexpr float kCloseButtonFullscreenHeight =
kUrlBarHeightDMM * kCloseButtonFullscreenDistance;
static constexpr float kCloseButtonFullscreenWidth =
kUrlBarHeightDMM * kCloseButtonFullscreenDistance;
static constexpr float kLoadingIndicatorWidth = 0.24f * kUrlBarDistance;
static constexpr float kLoadingIndicatorHeight = 0.008f * kUrlBarDistance;
static constexpr float kLoadingIndicatorWidth = 0.24 * kUrlBarDistance;
static constexpr float kLoadingIndicatorHeight = 0.008 * kUrlBarDistance;
static constexpr float kLoadingIndicatorVerticalOffset =
(-kUrlBarVerticalOffset + kContentVerticalOffset - kContentHeight / 2 -
kUrlBarHeight / 2) /
......@@ -110,7 +108,7 @@ static constexpr float kSceneHeight = 4.0;
static constexpr int kFloorGridlineCount = 40;
// Tiny distance to offset textures that should appear in the same plane.
static constexpr float kTextureOffset = 0.01f;
static constexpr float kTextureOffset = 0.01;
static constexpr float kUnderDevelopmentNoticeFontHeightM =
0.02f * kUrlBarDistance;
......@@ -118,7 +116,7 @@ static constexpr float kUnderDevelopmentNoticeHeightM = 0.1f * kUrlBarDistance;
static constexpr float kUnderDevelopmentNoticeWidthM = 0.44f * kUrlBarDistance;
static constexpr float kUnderDevelopmentNoticeVerticalOffsetM =
0.5f * kUnderDevelopmentNoticeHeightM + kUrlBarHeight;
static constexpr float kUnderDevelopmentNoticeRotationRad = -0.19f;
static constexpr float kUnderDevelopmentNoticeRotationRad = -0.19;
// If the screen space bounds or the aspect ratio of the content quad change
// beyond these thresholds we propagate the new content bounds so that the
......
......@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/math_constants.h"
#include "chrome/browser/vr/databinding/binding.h"
#include "chrome/browser/vr/elements/button.h"
#include "chrome/browser/vr/elements/close_button_texture.h"
......@@ -71,6 +70,9 @@ void BindColor(UiSceneManager* model, Text* text, P p) {
} // namespace
using TargetProperty::BOUNDS;
using TargetProperty::TRANSFORM;
UiSceneManager::UiSceneManager(UiBrowserInterface* browser,
UiScene* scene,
ContentInputDelegate* content_input_delegate,
......@@ -347,7 +349,7 @@ void UiSceneManager::CreateBackground() {
panel.y_offset * kSceneSize / 2,
panel.z_offset * kSceneSize / 2);
panel_element->SetRotate(panel.x_rotation, panel.y_rotation, 0,
base::kPiFloat / 2 * panel.angle);
M_PI_2 * panel.angle);
panel_element->set_hit_testable(false);
background_panels_.push_back(panel_element.get());
scene_->AddUiElement(k2dBrowsingBackground, std::move(panel_element));
......@@ -359,7 +361,7 @@ void UiSceneManager::CreateBackground() {
floor->set_draw_phase(kPhaseFloorCeiling);
floor->SetSize(kSceneSize, kSceneSize);
floor->SetTranslate(0.0, -kSceneHeight / 2, 0.0);
floor->SetRotate(1, 0, 0, -base::kPiFloat / 2);
floor->SetRotate(1, 0, 0, -M_PI_2);
floor->set_gridline_count(kFloorGridlineCount);
floor_ = floor.get();
scene_->AddUiElement(k2dBrowsingBackground, std::move(floor));
......@@ -370,7 +372,7 @@ void UiSceneManager::CreateBackground() {
ceiling->set_draw_phase(kPhaseFloorCeiling);
ceiling->SetSize(kSceneSize, kSceneSize);
ceiling->SetTranslate(0.0, kSceneHeight / 2, 0.0);
ceiling->SetRotate(1, 0, 0, base::kPiFloat / 2);
ceiling->SetRotate(1, 0, 0, M_PI_2);
ceiling_ = ceiling.get();
scene_->AddUiElement(k2dBrowsingBackground, std::move(ceiling));
......@@ -467,7 +469,7 @@ void UiSceneManager::CreateWebVrUrlToast() {
512,
base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this)));
url_bar->set_name(kWebVrUrlToast);
url_bar->set_opacity_when_visible(0.8f);
url_bar->set_opacity_when_visible(0.8);
url_bar->set_draw_phase(kPhaseOverlayForeground);
url_bar->SetVisible(true);
url_bar->set_hit_testable(false);
......@@ -485,7 +487,7 @@ void UiSceneManager::CreateCloseButton() {
base::MakeUnique<CloseButtonTexture>());
element->set_name(kCloseButton);
element->set_draw_phase(kPhaseForeground);
element->SetTranslate(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3f,
element->SetTranslate(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3,
-kCloseButtonDistance);
element->SetSize(kCloseButtonWidth, kCloseButtonHeight);
close_button_ = element.get();
......@@ -703,7 +705,7 @@ void UiSceneManager::ConfigureScene() {
->SetTranslate(0, kFullscreenVerticalOffset, -kFullscreenDistance);
main_content_->SetSize(kFullscreenWidth, kFullscreenHeight);
close_button_->SetTranslate(
0, kFullscreenVerticalOffset - (kFullscreenHeight / 2) - 0.35f,
0, kFullscreenVerticalOffset - (kFullscreenHeight / 2) - 0.35,
-kCloseButtonFullscreenDistance);
close_button_->SetSize(kCloseButtonFullscreenWidth,
kCloseButtonFullscreenHeight);
......@@ -713,7 +715,7 @@ void UiSceneManager::ConfigureScene() {
->SetTranslate(0, kContentVerticalOffset, -kContentDistance);
main_content_->SetSize(kContentWidth, kContentHeight);
close_button_->SetTranslate(
0, kContentVerticalOffset - (kContentHeight / 2) - 0.3f,
0, kContentVerticalOffset - (kContentHeight / 2) - 0.3,
-kCloseButtonDistance);
close_button_->SetSize(kCloseButtonWidth, kCloseButtonHeight);
}
......
......@@ -20,10 +20,13 @@
#include "chrome/browser/vr/ui_scene_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
namespace vr {
using TargetProperty::BOUNDS;
using TargetProperty::TRANSFORM;
using TargetProperty::OPACITY;
namespace {
const std::set<UiElementName> kFloorCeilingBackgroundElements = {
kBackgroundFront, kBackgroundLeft, kBackgroundBack, kBackgroundRight,
......@@ -57,8 +60,8 @@ const std::set<UiElementName> kElementsVisibleWithExitWarning = {
kScreenDimmer, kExitWarning,
};
static constexpr float kTolerance = 1e-5f;
static constexpr float kSmallDelaySeconds = 0.1f;
static constexpr float kTolerance = 1e-5;
static constexpr float kSmallDelaySeconds = 0.1;
MATCHER_P2(SizeFsAreApproximatelyEqual, other, tolerance, "") {
return cc::MathUtil::ApproximatelyEqual(arg.width(), other.width(),
......
......@@ -18,8 +18,8 @@ TEST(VrGlUtilTest, CalculateScreenSize) {
gfx::SizeF screen_size = CalculateScreenSize(kProjMatrix, model_matrix, size);
EXPECT_FLOAT_EQ(screen_size.width(), 0.49592164f);
EXPECT_FLOAT_EQ(screen_size.height(), 0.27598655f);
EXPECT_FLOAT_EQ(screen_size.width(), 0.49592164);
EXPECT_FLOAT_EQ(screen_size.height(), 0.27598655);
}
} // namespace vr
......@@ -147,8 +147,8 @@ static constexpr float kMidRingOpacity = 0.22f;
static constexpr float kReticleColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
// Laser constants
static constexpr float kFadeEnd = 0.535f;
static constexpr float kFadePoint = 0.5335f;
static constexpr float kFadeEnd = 0.535;
static constexpr float kFadePoint = 0.5335;
static constexpr float kLaserColor[] = {1.0f, 1.0f, 1.0f, 0.5f};
static constexpr int kLaserDataWidth = 48;
static constexpr int kLaserDataHeight = 1;
......
......@@ -9,8 +9,8 @@ declare_args() {
# Still requires command line flag to access API
# TODO(bshe): Enable for other architecture too. Currently we only support arm
# and arm64.
enable_vr = (is_android && (current_cpu == "arm" || current_cpu == "arm64") &&
!is_chromecast) || is_win
enable_vr = is_android && (current_cpu == "arm" || current_cpu == "arm64") &&
!is_chromecast
enable_openvr = false
# Whether to include VR extras like test APKs in non-VR-specific targets
......
......@@ -31,8 +31,6 @@ class DEVICE_VR_EXPORT FakeVRDeviceProvider : public VRDeviceProvider {
private:
std::vector<std::unique_ptr<VRDevice>> devices_;
bool initialized_;
DISALLOW_COPY_AND_ASSIGN(FakeVRDeviceProvider);
};
} // namespace device
......
......@@ -19,10 +19,6 @@ VRDevice::VRDevice() : presenting_display_(nullptr), id_(next_id_) {
VRDevice::~VRDevice() {}
unsigned int VRDevice::id() const {
return id_;
}
void VRDevice::AddDisplay(VRDisplayImpl* display) {
displays_.insert(display);
OnDisplayAdded(display);
......
......@@ -24,7 +24,7 @@ class DEVICE_VR_EXPORT VRDevice {
VRDevice();
virtual ~VRDevice();
unsigned int id() const;
unsigned int id() const { return id_; }
virtual mojom::VRDisplayInfoPtr GetVRDisplayInfo() = 0;
virtual void RequestPresent(
......
......@@ -1603,12 +1603,6 @@
},
"test": "viz_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "vr_common_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......@@ -2114,12 +2108,6 @@
},
"test": "viz_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "vr_common_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......
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