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

Side by Side Diff: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp

Issue 2700123003: DO NOT COMMIT: Results of running old (current) clang-format on Blink (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/TextResourceDecoderBuilder.h" 5 #include "core/loader/TextResourceDecoderBuilder.h"
6 6
7 #include <memory>
7 #include "core/testing/DummyPageHolder.h" 8 #include "core/testing/DummyPageHolder.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 #include <memory>
10 10
11 namespace blink { 11 namespace blink {
12 12
13 static const WTF::TextEncoding defaultEncodingForURL(const char* url) { 13 static const WTF::TextEncoding defaultEncodingForURL(const char* url) {
14 std::unique_ptr<DummyPageHolder> pageHolder = 14 std::unique_ptr<DummyPageHolder> pageHolder =
15 DummyPageHolder::create(IntSize(0, 0)); 15 DummyPageHolder::create(IntSize(0, 0));
16 Document& document = pageHolder->document(); 16 Document& document = pageHolder->document();
17 document.setURL(KURL(KURL(), url)); 17 document.setURL(KURL(KURL(), url));
18 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom); 18 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom);
19 return decoderBuilder.buildFor(&document)->encoding(); 19 return decoderBuilder.buildFor(&document)->encoding();
20 } 20 }
21 21
22 TEST(TextResourceDecoderBuilderTest, defaultEncodingComesFromTopLevelDomain) { 22 TEST(TextResourceDecoderBuilderTest, defaultEncodingComesFromTopLevelDomain) {
23 EXPECT_EQ(WTF::TextEncoding("Shift_JIS"), 23 EXPECT_EQ(WTF::TextEncoding("Shift_JIS"),
24 defaultEncodingForURL("http://tsubotaa.la.coocan.jp")); 24 defaultEncodingForURL("http://tsubotaa.la.coocan.jp"));
25 EXPECT_EQ(WTF::TextEncoding("windows-1251"), 25 EXPECT_EQ(WTF::TextEncoding("windows-1251"),
26 defaultEncodingForURL("http://udarenieru.ru/index.php")); 26 defaultEncodingForURL("http://udarenieru.ru/index.php"));
27 } 27 }
28 28
29 TEST(TextResourceDecoderBuilderTest, 29 TEST(TextResourceDecoderBuilderTest,
30 NoCountryDomainURLDefaultsToLatin1Encoding) { 30 NoCountryDomainURLDefaultsToLatin1Encoding) {
31 // Latin1 encoding is set in |TextResourceDecoder::defaultEncoding()|. 31 // Latin1 encoding is set in |TextResourceDecoder::defaultEncoding()|.
32 EXPECT_EQ(WTF::Latin1Encoding(), 32 EXPECT_EQ(WTF::Latin1Encoding(),
33 defaultEncodingForURL("http://arstechnica.com/about-us")); 33 defaultEncodingForURL("http://arstechnica.com/about-us"));
34 } 34 }
35 35
36 } // namespace blink 36 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698