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

Unified Diff: chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc

Issue 8879023: Reverting 8833008 which breaks CandidateWindowViewTest.MozcUpdateCandidateTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/chromeos/input_method/candidate_window_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc
diff --git a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc
index ed726a2e79561244d284fe95868b7603334a8564..5dcd3035dea6ed31125297372f7dce6abfdea50c 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc
@@ -1,14 +1,13 @@
// 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.
+// TODO(nona): Add unittests for UpdateCandidates.
#include "chrome/browser/chromeos/input_method/candidate_window_view.h"
#include <string>
-#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/views/widget/widget.h"
namespace chromeos {
namespace input_method {
@@ -58,18 +57,13 @@ void AppendCandidateIntoMozcCandidates(InputMethodLookupTable* table,
candidate->set_value(value);
candidate->set_id(current_entry_count);
candidate->set_information_id(current_entry_count);
+
+
}
} // namespace
-class CandidateWindowViewTest: public testing::Test {
- private:
- // This message loop is not explicitly used, but necessary for views control
- // testings.
- MessageLoopForUI message_loop_;
-};
-
-TEST_F(CandidateWindowViewTest, ShouldUpdateCandidateViewsTest) {
+TEST(CandidateWindowViewTest, ShouldUpdateCandidateViewsTest) {
// This test verifies the process of judging update lookup-table or not.
// This judgement is handled by ShouldUpdateCandidateViews, which returns true
// if update is necessary and vice versa.
@@ -182,7 +176,7 @@ TEST_F(CandidateWindowViewTest, ShouldUpdateCandidateViewsTest) {
new_table));
}
-TEST_F(CandidateWindowViewTest, MozcSuggestWindowShouldUpdateTest) {
+TEST(CandidateWindowViewTest, MozcSuggestWindowShouldUpdateTest) {
// ShouldUpdateCandidateViews method should also judge with consideration of
// the mozc specific candidate information. Following tests verify them.
const char* kSampleCandidate1 = "Sample Candidate 1";
@@ -337,77 +331,5 @@ TEST_F(CandidateWindowViewTest, MozcSuggestWindowShouldUpdateTest) {
new_table));
}
-TEST_F(CandidateWindowViewTest, MozcUpdateCandidateTest) {
- // This test verifies whether UpdateCandidates function updates window mozc
- // specific candidate position correctly on the correct condition.
- views::Widget widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
- params.bounds = gfx::Rect(0, 0, 100, 100);
- widget.Init(params);
-
- CandidateWindowView candidate_window_view(&widget);
- candidate_window_view.Init();
-
- const int kCaretPositionX1 = 10;
- const int kCaretPositionY1 = 20;
- const int kCaretPositionWidth1 = 30;
- const int kCaretPositionHeight1 = 40;
-
- const int kCaretPositionX2 = 15;
- const int kCaretPositionY2 = 25;
- const int kCaretPositionWidth2 = 35;
- const int kCaretPositionHeight2 = 45;
-
- InputMethodLookupTable new_table;
- ClearInputMethodLookupTable(&new_table);
- InitializeMozcCandidates(&new_table);
-
- // If window location is CARET, use default position. So
- // is_suggestion_window_location_available_ should be false.
- SetCaretRectIntoMozcCandidates(&new_table,
- mozc::commands::Candidates::CARET,
- kCaretPositionX1,
- kCaretPositionY1,
- kCaretPositionWidth1,
- kCaretPositionHeight1);
- candidate_window_view.UpdateCandidates(new_table);
- EXPECT_FALSE(candidate_window_view.is_suggestion_window_location_available_);
-
- // If window location is COMPOSITION, update position and set
- // is_suggestion_window_location_available_ as true.
- SetCaretRectIntoMozcCandidates(&new_table,
- mozc::commands::Candidates::COMPOSITION,
- kCaretPositionX1,
- kCaretPositionY1,
- kCaretPositionWidth1,
- kCaretPositionHeight1);
- candidate_window_view.UpdateCandidates(new_table);
- EXPECT_TRUE(candidate_window_view.is_suggestion_window_location_available_);
- EXPECT_EQ(kCaretPositionX1,
- candidate_window_view.suggestion_window_location_.x());
- EXPECT_EQ(kCaretPositionY1,
- candidate_window_view.suggestion_window_location_.y());
- EXPECT_EQ(kCaretPositionWidth1,
- candidate_window_view.suggestion_window_location_.width());
- EXPECT_EQ(kCaretPositionHeight1,
- candidate_window_view.suggestion_window_location_.height());
-
- SetCaretRectIntoMozcCandidates(&new_table,
- mozc::commands::Candidates::COMPOSITION,
- kCaretPositionX2,
- kCaretPositionY2,
- kCaretPositionWidth2,
- kCaretPositionHeight2);
- candidate_window_view.UpdateCandidates(new_table);
- EXPECT_TRUE(candidate_window_view.is_suggestion_window_location_available_);
- EXPECT_EQ(kCaretPositionX2,
- candidate_window_view.suggestion_window_location_.x());
- EXPECT_EQ(kCaretPositionY2,
- candidate_window_view.suggestion_window_location_.y());
- EXPECT_EQ(kCaretPositionWidth2,
- candidate_window_view.suggestion_window_location_.width());
- EXPECT_EQ(kCaretPositionHeight2,
- candidate_window_view.suggestion_window_location_.height());
-}
} // namespace input_method
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/input_method/candidate_window_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698