summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 20:06:24 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 20:06:24 +0000
commit4cb2a5c29732c0a047393b31e8f60562e07ceb04 (patch)
tree847cd2ddf6a79dbb0b2648b0caf0e7f32757c2e7 /base
parentabcc9ac80e3ca63efd2ebeb18954f79f56204e88 (diff)
downloadchromium_src-4cb2a5c29732c0a047393b31e8f60562e07ceb04.zip
chromium_src-4cb2a5c29732c0a047393b31e8f60562e07ceb04.tar.gz
chromium_src-4cb2a5c29732c0a047393b31e8f60562e07ceb04.tar.bz2
base/i18n: Put break_iterator* into namespace i18n.
BUG=None TEST=None R=brettw@chromium.org Review URL: http://codereview.chromium.org/7034012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/i18n/break_iterator.cc2
-rw-r--r--base/i18n/break_iterator.h4
-rw-r--r--base/i18n/break_iterator_unittest.cc38
3 files changed, 27 insertions, 17 deletions
diff --git a/base/i18n/break_iterator.cc b/base/i18n/break_iterator.cc
index edc8950..118600a 100644
--- a/base/i18n/break_iterator.cc
+++ b/base/i18n/break_iterator.cc
@@ -10,6 +10,7 @@
#include "unicode/ustring.h"
namespace base {
+namespace i18n {
const size_t npos = -1;
@@ -98,4 +99,5 @@ string16 BreakIterator::GetString() const {
return string_->substr(prev_, pos_ - prev_);
}
+} // namespace i18n
} // namespace base
diff --git a/base/i18n/break_iterator.h b/base/i18n/break_iterator.h
index f64a1e1..acd5c30 100644
--- a/base/i18n/break_iterator.h
+++ b/base/i18n/break_iterator.h
@@ -52,6 +52,7 @@
// }
namespace base {
+namespace i18n {
class BreakIterator {
public:
@@ -116,6 +117,7 @@ class BreakIterator {
DISALLOW_COPY_AND_ASSIGN(BreakIterator);
};
+} // namespace i18n
} // namespace base
-#endif // BASE_I18N_BREAK_ITERATOR_H__
+#endif // BASE_I18N_BREAK_ITERATOR_H_
diff --git a/base/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc
index a0bcee1..bc0cca3 100644
--- a/base/i18n/break_iterator_unittest.cc
+++ b/base/i18n/break_iterator_unittest.cc
@@ -1,17 +1,20 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 "base/i18n/break_iterator.h"
-#include "base/stringprintf.h"
#include "base/string_piece.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+namespace i18n {
+
TEST(BreakIteratorTest, BreakWordEmpty) {
string16 empty;
- base::BreakIterator iter(&empty, base::BreakIterator::BREAK_WORD);
+ BreakIterator iter(&empty, BreakIterator::BREAK_WORD);
ASSERT_TRUE(iter.Init());
EXPECT_FALSE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -22,7 +25,7 @@ TEST(BreakIteratorTest, BreakWordEmpty) {
TEST(BreakIteratorTest, BreakWord) {
string16 space(UTF8ToUTF16(" "));
string16 str(UTF8ToUTF16(" foo bar! \npouet boom"));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_WORD);
+ BreakIterator iter(&str, BreakIterator::BREAK_WORD);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -67,7 +70,7 @@ TEST(BreakIteratorTest, BreakWide16) {
L"\x03bf\x03c2\x0020\x0399\x03c3\x03c4\x03cc\x03c2"));
const string16 word1(str.substr(0, 10));
const string16 word2(str.substr(11, 5));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_WORD);
+ BreakIterator iter(&str, BreakIterator::BREAK_WORD);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_TRUE(iter.IsWord());
@@ -91,7 +94,7 @@ TEST(BreakIteratorTest, BreakWide32) {
UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
const string16 very_wide_word(str.substr(0, 2));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_WORD);
+ BreakIterator iter(&str, BreakIterator::BREAK_WORD);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_TRUE(iter.IsWord());
@@ -110,7 +113,7 @@ TEST(BreakIteratorTest, BreakWide32) {
TEST(BreakIteratorTest, BreakSpaceEmpty) {
string16 empty;
- base::BreakIterator iter(&empty, base::BreakIterator::BREAK_SPACE);
+ BreakIterator iter(&empty, BreakIterator::BREAK_SPACE);
ASSERT_TRUE(iter.Init());
EXPECT_FALSE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -120,7 +123,7 @@ TEST(BreakIteratorTest, BreakSpaceEmpty) {
TEST(BreakIteratorTest, BreakSpace) {
string16 str(UTF8ToUTF16(" foo bar! \npouet boom"));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_SPACE);
+ BreakIterator iter(&str, BreakIterator::BREAK_SPACE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -145,7 +148,7 @@ TEST(BreakIteratorTest, BreakSpace) {
TEST(BreakIteratorTest, BreakSpaceSP) {
string16 str(UTF8ToUTF16(" foo bar! \npouet boom "));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_SPACE);
+ BreakIterator iter(&str, BreakIterator::BREAK_SPACE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -175,7 +178,7 @@ TEST(BreakIteratorTest, BreakSpacekWide16) {
L"\x03bf\x03c2\x0020\x0399\x03c3\x03c4\x03cc\x03c2"));
const string16 word1(str.substr(0, 11));
const string16 word2(str.substr(11, 5));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_SPACE);
+ BreakIterator iter(&str, BreakIterator::BREAK_SPACE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -196,7 +199,7 @@ TEST(BreakIteratorTest, BreakSpaceWide32) {
UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
const string16 very_wide_word(str.substr(0, 3));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_SPACE);
+ BreakIterator iter(&str, BreakIterator::BREAK_SPACE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -212,7 +215,7 @@ TEST(BreakIteratorTest, BreakSpaceWide32) {
TEST(BreakIteratorTest, BreakLineEmpty) {
string16 empty;
- base::BreakIterator iter(&empty, base::BreakIterator::BREAK_NEWLINE);
+ BreakIterator iter(&empty, BreakIterator::BREAK_NEWLINE);
ASSERT_TRUE(iter.Init());
EXPECT_FALSE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -223,7 +226,7 @@ TEST(BreakIteratorTest, BreakLineEmpty) {
TEST(BreakIteratorTest, BreakLine) {
string16 nl(UTF8ToUTF16("\n"));
string16 str(UTF8ToUTF16("\nfoo bar!\n\npouet boom"));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_NEWLINE);
+ BreakIterator iter(&str, BreakIterator::BREAK_NEWLINE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -246,7 +249,7 @@ TEST(BreakIteratorTest, BreakLine) {
TEST(BreakIteratorTest, BreakLineNL) {
string16 nl(UTF8ToUTF16("\n"));
string16 str(UTF8ToUTF16("\nfoo bar!\n\npouet boom\n"));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_NEWLINE);
+ BreakIterator iter(&str, BreakIterator::BREAK_NEWLINE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -273,7 +276,7 @@ TEST(BreakIteratorTest, BreakLineWide16) {
L"\x03bf\x03c2\x000a\x0399\x03c3\x03c4\x03cc\x03c2"));
const string16 line1(str.substr(0, 11));
const string16 line2(str.substr(11, 5));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_NEWLINE);
+ BreakIterator iter(&str, BreakIterator::BREAK_NEWLINE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -293,7 +296,7 @@ TEST(BreakIteratorTest, BreakLineWide32) {
const string16 str(
UTF8ToUTF16(base::StringPrintf("%s\na", very_wide_char)));
const string16 very_wide_line(str.substr(0, 3));
- base::BreakIterator iter(&str, base::BreakIterator::BREAK_NEWLINE);
+ BreakIterator iter(&str, BreakIterator::BREAK_NEWLINE);
ASSERT_TRUE(iter.Init());
EXPECT_TRUE(iter.Advance());
EXPECT_FALSE(iter.IsWord());
@@ -306,3 +309,6 @@ TEST(BreakIteratorTest, BreakLineWide32) {
EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end.
EXPECT_FALSE(iter.IsWord());
}
+
+} // namespace i18n
+} // namespace base