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

Unified Diff: third_party/WebKit/Source/platform/testing/PlatformTestPrinters.cpp

Issue 1722893002: [LoaderTest] Add the gtest pretty printer for ResourceError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp1274063003
Patch Set: Rebase Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/platform/network/ResourceError.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/testing/PlatformTestPrinters.cpp
diff --git a/third_party/WebKit/Source/platform/testing/PlatformTestPrinters.cpp b/third_party/WebKit/Source/platform/testing/PlatformTestPrinters.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a26478353321cc9ce869cb70b81c898d88e4267f
--- /dev/null
+++ b/third_party/WebKit/Source/platform/testing/PlatformTestPrinters.cpp
@@ -0,0 +1,30 @@
+// 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 "platform/network/ResourceError.h"
+#include <ostream>
+
+// Pretty printer for gtest.
+// Each corresponding declaration should be placed in the header file of
+// the corresponding class (e.g. ResourceError.h) to avoid ODR violations,
+// not in e.g. PlatformTestPrinters.h. See https://crbug.com/514330.
+
+namespace blink {
+
+std::ostream& operator<<(std::ostream& os, const ResourceError& error)
+{
+ return os
+ << "domain = " << error.domain()
+ << ", errorCode = " << error.errorCode()
+ << ", failingURL = " << error.failingURL()
+ << ", localizedDescription = " << error.localizedDescription()
+ << ", isNull = " << error.isNull()
+ << ", isCancellation = " << error.isCancellation()
+ << ", isAccessCheck = " << error.isAccessCheck()
+ << ", isTimeout = " << error.isTimeout()
+ << ", staleCopyInCache = " << error.staleCopyInCache()
+ << ", wasIgnoredByHandler = " << error.wasIgnoredByHandler();
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/network/ResourceError.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698