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

Side by Side Diff: chrome/browser/ui/find_bar/find_backend_unittest.cc

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/string16.h" 5 #include "base/string16.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/find_bar/find_bar_state.h" 8 #include "chrome/browser/ui/find_bar/find_bar_state.h"
9 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 9 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
(...skipping 24 matching lines...) Expand all
35 35
36 // This test takes two TabContents objects, searches in both of them and 36 // This test takes two TabContents objects, searches in both of them and
37 // tests the internal state for find_text and find_prepopulate_text. 37 // tests the internal state for find_text and find_prepopulate_text.
38 TEST_F(FindBackendTest, InternalState) { 38 TEST_F(FindBackendTest, InternalState) {
39 FindTabHelper* find_tab_helper = contents_wrapper()->find_tab_helper(); 39 FindTabHelper* find_tab_helper = contents_wrapper()->find_tab_helper();
40 // Initial state for the TabContents is blank strings. 40 // Initial state for the TabContents is blank strings.
41 EXPECT_EQ(string16(), FindPrepopulateText(contents())); 41 EXPECT_EQ(string16(), FindPrepopulateText(contents()));
42 EXPECT_EQ(string16(), find_tab_helper->find_text()); 42 EXPECT_EQ(string16(), find_tab_helper->find_text());
43 43
44 // Get another TabContents object ready. 44 // Get another TabContents object ready.
45 TestTabContents* contents2 = new TestTabContents(profile_.get(), NULL); 45 TestTabContents* contents2 = new TestTabContents(profile(), NULL);
46 TabContentsWrapper wrapper2(contents2); 46 TabContentsWrapper wrapper2(contents2);
47 FindTabHelper* find_tab_helper2 = wrapper2.find_tab_helper(); 47 FindTabHelper* find_tab_helper2 = wrapper2.find_tab_helper();
48 48
49 // No search has still been issued, strings should be blank. 49 // No search has still been issued, strings should be blank.
50 EXPECT_EQ(string16(), FindPrepopulateText(contents())); 50 EXPECT_EQ(string16(), FindPrepopulateText(contents()));
51 EXPECT_EQ(string16(), find_tab_helper->find_text()); 51 EXPECT_EQ(string16(), find_tab_helper->find_text());
52 EXPECT_EQ(string16(), FindPrepopulateText(contents2)); 52 EXPECT_EQ(string16(), FindPrepopulateText(contents2));
53 EXPECT_EQ(string16(), find_tab_helper2->find_text()); 53 EXPECT_EQ(string16(), find_tab_helper2->find_text());
54 54
55 string16 search_term1 = ASCIIToUTF16(" I had a 401K "); 55 string16 search_term1 = ASCIIToUTF16(" I had a 401K ");
(...skipping 26 matching lines...) Expand all
82 // find_tab_helper (as indicated by the last two params). 82 // find_tab_helper (as indicated by the last two params).
83 find_tab_helper->StartFinding(search_term3, true, false); 83 find_tab_helper->StartFinding(search_term3, true, false);
84 84
85 // Once more, pre-populate string should always match between the two, but 85 // Once more, pre-populate string should always match between the two, but
86 // find_text should not. 86 // find_text should not.
87 EXPECT_EQ(search_term3, FindPrepopulateText(contents())); 87 EXPECT_EQ(search_term3, FindPrepopulateText(contents()));
88 EXPECT_EQ(search_term3, find_tab_helper->find_text()); 88 EXPECT_EQ(search_term3, find_tab_helper->find_text());
89 EXPECT_EQ(search_term3, FindPrepopulateText(contents2)); 89 EXPECT_EQ(search_term3, FindPrepopulateText(contents2));
90 EXPECT_EQ(search_term2, find_tab_helper2->find_text()); 90 EXPECT_EQ(search_term2, find_tab_helper2->find_text());
91 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698