Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/strings/utf_string_conversions.h" |
Bill Orr | 05fb10e | 2017-10-14 08:32:54 | [diff] [blame] | 6 | #include "build/build_config.h" |
Tommy C. Li | 1a26664 | 2018-10-30 18:58:37 | [diff] [blame] | 7 | #include "chrome/browser/vr/model/location_bar_state.h" |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 8 | #include "chrome/browser/vr/test/constants.h" |
| 9 | #include "chrome/browser/vr/test/ui_pixel_test.h" |
Tommy C. Li | 3dac904 | 2018-10-29 17:52:34 | [diff] [blame] | 10 | #include "components/omnibox/browser/vector_icons.h" |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 11 | #include "testing/gtest/include/gtest/gtest.h" |
| 12 | |
| 13 | namespace vr { |
| 14 | |
| 15 | namespace { |
| 16 | |
Aldo Culquicondor | 9152d53 | 2018-09-25 14:55:14 | [diff] [blame] | 17 | constexpr gfx::Transform kIdentity; |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 18 | |
| 19 | } // namespace |
| 20 | |
Alex Cooper | 29432cf | 2020-01-09 01:12:06 | [diff] [blame] | 21 | TEST_F(UiPixelTest, DrawVrBrowsingMode) { |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 22 | // Set up scene. |
| 23 | UiInitialState ui_initial_state; |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 24 | ui_initial_state.in_web_vr = false; |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 25 | MakeUi(ui_initial_state, |
Tommy C. Li | 1a26664 | 2018-10-30 18:58:37 | [diff] [blame] | 26 | LocationBarState(GURL("https://example.com"), security_state::SECURE, |
| 27 | &omnibox::kHttpsValidIcon, true, false)); |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 28 | |
| 29 | // Draw UI. |
| 30 | DrawUi(gfx::Vector3dF(0.0f, 0.0f, -1.0f), gfx::Point3F(0.5f, -0.5f, 0.0f), |
Aldo Culquicondor | 6cd1c82 | 2018-08-16 20:27:11 | [diff] [blame] | 31 | ControllerModel::ButtonState::kUp, 1.0f, kIdentity, kIdentity, |
Aldo Culquicondor | cc004c7 | 2018-08-02 14:50:02 | [diff] [blame] | 32 | GetPixelDaydreamProjMatrix()); |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 33 | |
| 34 | // Read pixels into SkBitmap. |
| 35 | auto bitmap = SaveCurrentFrameBufferToSkBitmap(); |
| 36 | EXPECT_TRUE(bitmap); |
Tibor Goldschwendt | f9b5acd | 2017-09-29 13:59:03 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | } // namespace vr |