Index: third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp |
diff --git a/third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp b/third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bbef135aeedbb41162d00d5999bb0b72366a5442 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp |
@@ -0,0 +1,41 @@ |
+// Copyright 2016 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. |
+ |
+#include "core/css/MediaValuesInitialViewport.h" |
+ |
+#include "core/frame/FrameView.h" |
+#include "core/testing/DummyPageHolder.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace blink { |
+ |
+class MediaValuesInitialViewportTest : public ::testing::Test { |
+ protected: |
+ Document& document() const { return m_dummyPageHolder->document(); } |
+ |
+ private: |
+ void SetUp() override { |
+ m_dummyPageHolder = DummyPageHolder::create(IntSize(320, 480)); |
+ } |
+ |
+ std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
+}; |
+ |
+TEST_F(MediaValuesInitialViewportTest, InitialViewportSize) { |
+ FrameView* view = document().view(); |
+ ASSERT_TRUE(view); |
+ EXPECT_TRUE(view->layoutSizeFixedToFrameSize()); |
+ |
+ MediaValues* mediaValues = |
+ MediaValuesInitialViewport::create(*document().frame()); |
+ EXPECT_EQ(320, mediaValues->viewportWidth()); |
+ EXPECT_EQ(480, mediaValues->viewportHeight()); |
+ |
+ view->setLayoutSizeFixedToFrameSize(false); |
+ view->setLayoutSize(IntSize(800, 600)); |
+ EXPECT_EQ(320, mediaValues->viewportWidth()); |
+ EXPECT_EQ(480, mediaValues->viewportHeight()); |
+} |
+ |
+} // namespace blink |