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

Unified Diff: chrome/browser/spellchecker/spellcheck_action_unittest.cc

Issue 2159283003: [WIP][DO NOT LAND] Componentize spellcheck Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: chrome/browser/spellchecker/spellcheck_action_unittest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_action_unittest.cc b/chrome/browser/spellchecker/spellcheck_action_unittest.cc
deleted file mode 100644
index 227f7133d02ba713c815d58f4dcc5f11a83da1d7..0000000000000000000000000000000000000000
--- a/chrome/browser/spellchecker/spellcheck_action_unittest.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2013 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 "chrome/browser/spellchecker/spellcheck_action.h"
-
-#include <stddef.h>
-
-#include <memory>
-#include <string>
-
-#include "base/json/json_reader.h"
-#include "base/macros.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-TEST(SpellcheckActionTest, FinalActionsTest) {
- static const SpellcheckAction::SpellcheckActionType kFinalActions[] = {
- SpellcheckAction::TYPE_ADD_TO_DICT,
- SpellcheckAction::TYPE_IGNORE,
- SpellcheckAction::TYPE_IN_DICTIONARY,
- SpellcheckAction::TYPE_MANUALLY_CORRECTED,
- SpellcheckAction::TYPE_NO_ACTION,
- SpellcheckAction::TYPE_SELECT,
- };
- SpellcheckAction action;
- for (size_t i = 0; i < arraysize(kFinalActions); ++i) {
- action.set_type(kFinalActions[i]);
- ASSERT_TRUE(action.IsFinal());
- }
-}
-
-TEST(SpellcheckActionTest, PendingActionsTest) {
- static const SpellcheckAction::SpellcheckActionType kPendingActions[] = {
- SpellcheckAction::TYPE_PENDING,
- SpellcheckAction::TYPE_PENDING_IGNORE,
- };
- SpellcheckAction action;
- for (size_t i = 0; i < arraysize(kPendingActions); ++i) {
- action.set_type(kPendingActions[i]);
- ASSERT_FALSE(action.IsFinal());
- }
-}
-
-TEST(SpellcheckActionTest, FinalizeTest) {
- SpellcheckAction action;
- action.set_type(SpellcheckAction::TYPE_PENDING);
- action.Finalize();
- ASSERT_EQ(SpellcheckAction::TYPE_NO_ACTION, action.type());
-
- action.set_type(SpellcheckAction::TYPE_PENDING_IGNORE);
- action.Finalize();
- ASSERT_EQ(SpellcheckAction::TYPE_IGNORE, action.type());
-}
-
-TEST(SpellcheckActionTest, SerializeTest) {
- static const size_t kNumTestCases = 7;
- static const struct {
- SpellcheckAction action;
- std::string expected;
- } kTestCases[] = {
- { SpellcheckAction(
- SpellcheckAction::TYPE_ADD_TO_DICT, -1,
- base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"ADD_TO_DICT\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_IGNORE, -1, base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"IGNORE\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_IN_DICTIONARY, -1,
- base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"IN_DICTIONARY\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_MANUALLY_CORRECTED, -1,
- base::ASCIIToUTF16("hello")),
- "{\"actionTargetValue\": \"hello\","
- "\"actionType\": \"MANUALLY_CORRECTED\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_NO_ACTION, -1, base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"NO_ACTION\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_PENDING, -1, base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"PENDING\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_PENDING_IGNORE, -1,
- base::ASCIIToUTF16("nothing")),
- "{\"actionType\": \"PENDING\"}" },
- { SpellcheckAction(
- SpellcheckAction::TYPE_SELECT, 42, base::ASCIIToUTF16("nothing")),
- "{\"actionTargetIndex\": 42, \"actionType\": \"SELECT\"}" },
- };
- for (size_t i = 0; i < kNumTestCases; ++i) {
- std::unique_ptr<base::DictionaryValue> serialized(
- kTestCases[i].action.Serialize());
- std::unique_ptr<base::Value> expected =
- base::JSONReader::Read(kTestCases[i].expected);
- EXPECT_TRUE(serialized->Equals(expected.get()));
- }
-}
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_action.cc ('k') | chrome/browser/spellchecker/spellcheck_custom_dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698