diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 18:13:53 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 18:13:53 +0000 |
commit | e5d2f713578962c4a2dc25dffe4002bb4153bfcb (patch) | |
tree | f8026c823028e7b835259c18ed2685f771cef244 /chrome/browser/find_backend_unittest.cc | |
parent | 51b623da27ffd93a28b03377d43a407f7811d292 (diff) | |
download | chromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.zip chromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.tar.gz chromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.tar.bz2 |
Do not prepopulate the findbar with incognito search terms.
BUG=32021
TEST=On win/linux, open an incognito window and search for some term. Then open a new normal tab and press Ctrl-F. Findbar should not be prepopoulated with your incognito search term.
Review URL: http://codereview.chromium.org/1561018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/find_backend_unittest.cc')
-rw-r--r-- | chrome/browser/find_backend_unittest.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/chrome/browser/find_backend_unittest.cc b/chrome/browser/find_backend_unittest.cc index e00e3e9..b927b35 100644 --- a/chrome/browser/find_backend_unittest.cc +++ b/chrome/browser/find_backend_unittest.cc @@ -2,26 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/string16.h" #include "base/string_util.h" +#include "chrome/browser/find_bar_state.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/url_constants.h" typedef RenderViewHostTestHarness FindBackendTest; +namespace { + +string16 FindPrepopulateText(TabContents* contents) { + return FindBarState::GetLastPrepopulateText(contents->profile()); +} + +} // end namespace + // This test takes two TabContents objects, searches in both of them and // tests the internal state for find_text and find_prepopulate_text. TEST_F(FindBackendTest, InternalState) { // Initial state for the TabContents is blank strings. - EXPECT_EQ(string16(), contents()->find_prepopulate_text()); + EXPECT_EQ(string16(), FindPrepopulateText(contents())); EXPECT_EQ(string16(), contents()->find_text()); // Get another TabContents object ready. TestTabContents contents2(profile_.get(), NULL); // No search has still been issued, strings should be blank. - EXPECT_EQ(string16(), contents()->find_prepopulate_text()); + EXPECT_EQ(string16(), FindPrepopulateText(contents())); EXPECT_EQ(string16(), contents()->find_text()); - EXPECT_EQ(string16(), contents2.find_prepopulate_text()); + EXPECT_EQ(string16(), FindPrepopulateText(&contents2)); EXPECT_EQ(string16(), contents2.find_text()); string16 search_term1 = ASCIIToUTF16(" I had a 401K "); @@ -34,9 +44,9 @@ TEST_F(FindBackendTest, InternalState) { // Pre-populate string should always match between the two, but find_text // should not. - EXPECT_EQ(search_term1, contents()->find_prepopulate_text()); + EXPECT_EQ(search_term1, FindPrepopulateText(contents())); EXPECT_EQ(search_term1, contents()->find_text()); - EXPECT_EQ(search_term1, contents2.find_prepopulate_text()); + EXPECT_EQ(search_term1, FindPrepopulateText(&contents2)); EXPECT_EQ(string16(), contents2.find_text()); // Now search in the other TabContents, searching forwards but not case @@ -45,9 +55,9 @@ TEST_F(FindBackendTest, InternalState) { // Again, pre-populate string should always match between the two, but // find_text should not. - EXPECT_EQ(search_term2, contents()->find_prepopulate_text()); + EXPECT_EQ(search_term2, FindPrepopulateText(contents())); EXPECT_EQ(search_term1, contents()->find_text()); - EXPECT_EQ(search_term2, contents2.find_prepopulate_text()); + EXPECT_EQ(search_term2, FindPrepopulateText(&contents2)); EXPECT_EQ(search_term2, contents2.find_text()); // Search again in the first TabContents, searching forwards but not case @@ -56,8 +66,8 @@ TEST_F(FindBackendTest, InternalState) { // Once more, pre-populate string should always match between the two, but // find_text should not. - EXPECT_EQ(search_term3, contents()->find_prepopulate_text()); + EXPECT_EQ(search_term3, FindPrepopulateText(contents())); EXPECT_EQ(search_term3, contents()->find_text()); - EXPECT_EQ(search_term3, contents2.find_prepopulate_text()); + EXPECT_EQ(search_term3, FindPrepopulateText(&contents2)); EXPECT_EQ(search_term2, contents2.find_text()); } |