1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/search_engines/template_url_data.h"
7 #include "base/strings/string_piece.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 TEST(TemplateURLDataTest, Trim) {
14 u" shortname ", u" keyword ", "https://cs.chromium.org",
15 base::StringPiece(), base::StringPiece(), base::StringPiece(),
16 base::StringPiece(), base::StringPiece(), base::StringPiece(),
17 base::StringPiece(), base::StringPiece(), base::StringPiece(),
18 base::StringPiece(), base::StringPiece(), base::StringPiece(),
19 base::StringPiece(), base::StringPiece(), {}, base::StringPiece(),
20 base::StringPiece(), base::StringPiece16(), base::Value::List(), false,
23 EXPECT_EQ(u"shortname", data.short_name());
24 EXPECT_EQ(u"keyword", data.keyword());
26 data.SetShortName(u" othershortname ");
27 data.SetKeyword(u" otherkeyword ");
29 EXPECT_EQ(u"othershortname", data.short_name());
30 EXPECT_EQ(u"otherkeyword", data.keyword());