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

Unified Diff: third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp

Issue 2414343002: Implement MediaValues for initial viewport. (Closed)
Patch Set: CORE_EXPORT in inheritance chain for Windows Created 4 years, 2 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: 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

Powered by Google App Engine
This is Rietveld 408576698