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

Unified Diff: chrome/browser/net/client_hints_unittest.cc

Issue 11970002: Added Client-Hints. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changed ClientHints to use WeakPtr and addressed comments Created 7 years, 10 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: chrome/browser/net/client_hints_unittest.cc
diff --git a/chrome/browser/net/client_hints_unittest.cc b/chrome/browser/net/client_hints_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e7d887dd4083b9d2c745294832284ae15e986273
--- /dev/null
+++ b/chrome/browser/net/client_hints_unittest.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 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 "chrome/browser/net/client_hints.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class ClientHintsTest : public testing::Test {
+ protected:
+ ClientHintsTest() {}
+
+ virtual void SetUp() OVERRIDE {
Ryan Sleevi 2013/02/26 02:21:04 1) No need to use OVERRIDE for testing::Test overr
bengr 2013/02/26 18:19:53 Done.
+ client_hints_ = new ClientHints();
+ ClientHints::ScreenInfo info;
+ info.width = 100;
+ info.height = 200;
+ info.pixel_ratio = 1.567;
+ client_hints_->UpdateScreenInfo(&info);
+ }
+
+ virtual void TearDown() OVERRIDE {
+ client_hints_ = NULL;
+ }
+
+ scoped_refptr<ClientHints> client_hints_;
+};
+
+TEST_F(ClientHintsTest, HintsWellFormatted) {
Ryan Sleevi 2013/02/26 02:21:04 Are there any other edge cases you can be testing
bengr 2013/02/26 18:19:53 Not really. These values should be positive. I sup
+ std::string hint = client_hints_->GetScreenInfoHints();
+ EXPECT_EQ("dh=200, dw=100, dpr=1.57", hint);
+}
+

Powered by Google App Engine
This is Rietveld 408576698