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

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

Issue 1230933002: Patch 3.1: Refactored spellcheck_message_filter to be generic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@platform_flag
Patch Set: Updated gn build variable to match gyp side Created 5 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_message_filter_mac_unittest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_message_filter_mac_unittest.cc b/chrome/browser/spellchecker/spellcheck_message_filter_mac_unittest.cc
deleted file mode 100644
index 4cab6d6bacc665329ff1d04192df0a4fe4505a7c..0000000000000000000000000000000000000000
--- a/chrome/browser/spellchecker/spellcheck_message_filter_mac_unittest.cc
+++ /dev/null
@@ -1,63 +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_message_filter_mac.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/common/spellcheck_messages.h"
-#include "chrome/common/spellcheck_result.h"
-#include "content/public/browser/browser_thread.h"
-#include "ipc/ipc_message.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-TEST(SpellcheckMessageFilterMacTest, CombineResults) {
- std::vector<SpellCheckResult> local_results;
- std::vector<SpellCheckResult> remote_results;
- base::string16 remote_suggestion = base::ASCIIToUTF16("remote");
- base::string16 local_suggestion = base::ASCIIToUTF16("local");
-
- // Remote-only result - must be flagged as GRAMMAR after combine
- remote_results.push_back(
- SpellCheckResult(SpellCheckResult::SPELLING, 0, 5));
-
- // Local-only result - must be discarded after combine
- local_results.push_back(
- SpellCheckResult(SpellCheckResult::SPELLING, 10, 5));
-
- // local & remote result - must be flagged SPELLING, uses remote suggestion.
- SpellCheckResult result(SpellCheckResult::SPELLING, 20, 5, local_suggestion);
- local_results.push_back(result);
- result.replacement = remote_suggestion;
- remote_results.push_back(result);
-
- SpellCheckMessageFilterMac::CombineResults(&remote_results, local_results);
-
- ASSERT_EQ(2U, remote_results.size());
- EXPECT_EQ(SpellCheckResult::GRAMMAR, remote_results[0].decoration);
- EXPECT_EQ(0, remote_results[0].location);
- EXPECT_EQ(SpellCheckResult::SPELLING, remote_results[1].decoration);
- EXPECT_EQ(20, remote_results[1].location);
- EXPECT_EQ(remote_suggestion, remote_results[1].replacement);
-}
-
-TEST(SpellCheckMessageFilterMacTest, TestOverrideThread) {
- static const uint32 kSpellcheckMessages[] = {
- SpellCheckHostMsg_RequestTextCheck::ID,
- };
- scoped_refptr<SpellCheckMessageFilterMac> filter(
- new SpellCheckMessageFilterMac(0));
- content::BrowserThread::ID thread;
- IPC::Message message;
- for (size_t i = 0; i < arraysize(kSpellcheckMessages); ++i) {
- message.SetHeaderValues(
- 0, kSpellcheckMessages[i], IPC::Message::PRIORITY_NORMAL);
- thread = content::BrowserThread::IO;
- filter->OverrideThreadForMessage(message, &thread);
- EXPECT_EQ(content::BrowserThread::UI, thread);
- }
-}
-
-} // namespace

Powered by Google App Engine
This is Rietveld 408576698