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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 "core/testing/DummyPageHolder.h" 7 #include "core/testing/DummyPageHolder.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include <memory>
9 10
10 namespace blink { 11 namespace blink {
11 12
12 static const WTF::TextEncoding defaultEncodingForURL(const char* url) 13 static const WTF::TextEncoding defaultEncodingForURL(const char* url)
13 { 14 {
14 OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(0, 0)); 15 std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSiz e(0, 0));
15 Document& document = pageHolder->document(); 16 Document& document = pageHolder->document();
16 document.setURL(KURL(KURL(), url)); 17 document.setURL(KURL(KURL(), url));
17 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom); 18 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom);
18 return decoderBuilder.buildFor(&document)->encoding(); 19 return decoderBuilder.buildFor(&document)->encoding();
19 } 20 }
20 21
21 TEST(TextResourceDecoderBuilderTest, defaultEncodingComesFromTopLevelDomain) 22 TEST(TextResourceDecoderBuilderTest, defaultEncodingComesFromTopLevelDomain)
22 { 23 {
23 EXPECT_EQ(WTF::TextEncoding("Shift_JIS"), defaultEncodingForURL("http://tsub otaa.la.coocan.jp")); 24 EXPECT_EQ(WTF::TextEncoding("Shift_JIS"), defaultEncodingForURL("http://tsub otaa.la.coocan.jp"));
24 EXPECT_EQ(WTF::TextEncoding("windows-1251"), defaultEncodingForURL("http://u darenieru.ru/index.php")); 25 EXPECT_EQ(WTF::TextEncoding("windows-1251"), defaultEncodingForURL("http://u darenieru.ru/index.php"));
25 } 26 }
26 27
27 TEST(TextResourceDecoderBuilderTest, NoCountryDomainURLDefaultsToLatin1Encoding) 28 TEST(TextResourceDecoderBuilderTest, NoCountryDomainURLDefaultsToLatin1Encoding)
28 { 29 {
29 // Latin1 encoding is set in |TextResourceDecoder::defaultEncoding()|. 30 // Latin1 encoding is set in |TextResourceDecoder::defaultEncoding()|.
30 EXPECT_EQ(WTF::Latin1Encoding(), defaultEncodingForURL("http://arstechnica.c om/about-us")); 31 EXPECT_EQ(WTF::Latin1Encoding(), defaultEncodingForURL("http://arstechnica.c om/about-us"));
31 } 32 }
32 33
33 } // namespace blink 34 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698