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

Side by Side Diff: athena/home/athena_start_page_view_unittest.cc

Issue 668443002: Changes HomeCard to fullscreen from bottom when typing a query. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « athena/home/athena_start_page_view.cc ('k') | athena/home/home_card_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/home/athena_start_page_view.h" 5 #include "athena/home/athena_start_page_view.h"
6 6
7 #include "athena/home/home_card_constants.h" 7 #include "athena/home/home_card_constants.h"
8 #include "athena/test/base/athena_test_base.h" 8 #include "athena/test/base/athena_test_base.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 void SetSearchQuery(const base::string16& query) { 96 void SetSearchQuery(const base::string16& query) {
97 view_delegate_.GetModel()->search_box()->SetText(query); 97 view_delegate_.GetModel()->search_box()->SetText(query);
98 } 98 }
99 99
100 base::string16 GetVisibleQuery() { 100 base::string16 GetVisibleQuery() {
101 return view_->search_box_view_->search_box()->text(); 101 return view_->search_box_view_->search_box()->text();
102 } 102 }
103 103
104 float layout_state() { return view_->layout_state_; }
105
104 scoped_ptr<AthenaStartPageView> view_; 106 scoped_ptr<AthenaStartPageView> view_;
105 107
106 private: 108 private:
107 AthenaTestViewDelegate view_delegate_; 109 AthenaTestViewDelegate view_delegate_;
108 110
109 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageViewTest); 111 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageViewTest);
110 }; 112 };
111 113
112 TEST_F(AthenaStartPageViewTest, BasicLayout) { 114 TEST_F(AthenaStartPageViewTest, BasicLayout) {
113 // BOTTOM state. logo is invisible. icons, search box, and controls are 115 // BOTTOM state. logo is invisible. icons, search box, and controls are
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 EXPECT_FALSE(IsLogoVisible()); 221 EXPECT_FALSE(IsLogoVisible());
220 EXPECT_GT(base_search_box_bounds.y(), GetSearchBoxBounds().y()); 222 EXPECT_GT(base_search_box_bounds.y(), GetSearchBoxBounds().y());
221 EXPECT_EQ(query, GetVisibleQuery()); 223 EXPECT_EQ(query, GetVisibleQuery());
222 224
223 SetSearchQuery(base::string16()); 225 SetSearchQuery(base::string16());
224 EXPECT_TRUE(IsLogoVisible()); 226 EXPECT_TRUE(IsLogoVisible());
225 EXPECT_EQ(base_search_box_bounds.ToString(), GetSearchBoxBounds().ToString()); 227 EXPECT_EQ(base_search_box_bounds.ToString(), GetSearchBoxBounds().ToString());
226 EXPECT_TRUE(GetVisibleQuery().empty()); 228 EXPECT_TRUE(GetVisibleQuery().empty());
227 } 229 }
228 230
231 TEST_F(AthenaStartPageViewTest, SearchFromBottom) {
232 view_->SetLayoutState(0.0f);
233
234 const base::string16 query = base::UTF8ToUTF16("test");
235 SetSearchQuery(query);
236
237 EXPECT_FALSE(IsLogoVisible());
238 EXPECT_EQ(query, GetVisibleQuery());
239 EXPECT_EQ(1.0f, layout_state());
240
241 SetSearchQuery(base::string16());
242 EXPECT_TRUE(IsLogoVisible());
243 EXPECT_TRUE(GetVisibleQuery().empty());
244 EXPECT_EQ(1.0f, layout_state());
245 }
246
229 } // namespace athena 247 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/athena_start_page_view.cc ('k') | athena/home/home_card_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698