| OLD | NEW | 
|   1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2012 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/strings/string16.h" |   5 #include "base/strings/string16.h" | 
|   6 #include "base/strings/string_util.h" |   6 #include "base/strings/string_util.h" | 
|   7 #include "base/strings/utf_string_conversions.h" |   7 #include "base/strings/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_bar_state_factory.h" |   9 #include "chrome/browser/ui/find_bar/find_bar_state_factory.h" | 
|  10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |  10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  49   FindTabHelper::CreateForWebContents(contents2.get()); |  49   FindTabHelper::CreateForWebContents(contents2.get()); | 
|  50   FindTabHelper* find_tab_helper2 = |  50   FindTabHelper* find_tab_helper2 = | 
|  51       FindTabHelper::FromWebContents(contents2.get()); |  51       FindTabHelper::FromWebContents(contents2.get()); | 
|  52  |  52  | 
|  53   // No search has still been issued, strings should be blank. |  53   // No search has still been issued, strings should be blank. | 
|  54   EXPECT_EQ(base::string16(), FindPrepopulateText(web_contents())); |  54   EXPECT_EQ(base::string16(), FindPrepopulateText(web_contents())); | 
|  55   EXPECT_EQ(base::string16(), find_tab_helper->find_text()); |  55   EXPECT_EQ(base::string16(), find_tab_helper->find_text()); | 
|  56   EXPECT_EQ(base::string16(), FindPrepopulateText(contents2.get())); |  56   EXPECT_EQ(base::string16(), FindPrepopulateText(contents2.get())); | 
|  57   EXPECT_EQ(base::string16(), find_tab_helper2->find_text()); |  57   EXPECT_EQ(base::string16(), find_tab_helper2->find_text()); | 
|  58  |  58  | 
|  59   base::string16 search_term1 = ASCIIToUTF16(" I had a 401K    "); |  59   base::string16 search_term1 = base::ASCIIToUTF16(" I had a 401K    "); | 
|  60   base::string16 search_term2 = ASCIIToUTF16(" but the economy "); |  60   base::string16 search_term2 = base::ASCIIToUTF16(" but the economy "); | 
|  61   base::string16 search_term3 = ASCIIToUTF16(" eated it.       "); |  61   base::string16 search_term3 = base::ASCIIToUTF16(" eated it.       "); | 
|  62  |  62  | 
|  63   // Start searching in the first WebContents, searching forwards but not case |  63   // Start searching in the first WebContents, searching forwards but not case | 
|  64   // sensitive (as indicated by the last two params). |  64   // sensitive (as indicated by the last two params). | 
|  65   find_tab_helper->StartFinding(search_term1, true, false); |  65   find_tab_helper->StartFinding(search_term1, true, false); | 
|  66  |  66  | 
|  67   // Pre-populate string should always match between the two, but find_text |  67   // Pre-populate string should always match between the two, but find_text | 
|  68   // should not. |  68   // should not. | 
|  69   EXPECT_EQ(search_term1, FindPrepopulateText(web_contents())); |  69   EXPECT_EQ(search_term1, FindPrepopulateText(web_contents())); | 
|  70   EXPECT_EQ(search_term1, find_tab_helper->find_text()); |  70   EXPECT_EQ(search_term1, find_tab_helper->find_text()); | 
|  71   EXPECT_EQ(search_term1, FindPrepopulateText(contents2.get())); |  71   EXPECT_EQ(search_term1, FindPrepopulateText(contents2.get())); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  86   // find_tab_helper (as indicated by the last two params). |  86   // find_tab_helper (as indicated by the last two params). | 
|  87   find_tab_helper->StartFinding(search_term3, true, false); |  87   find_tab_helper->StartFinding(search_term3, true, false); | 
|  88  |  88  | 
|  89   // Once more, pre-populate string should always match between the two, but |  89   // Once more, pre-populate string should always match between the two, but | 
|  90   // find_text should not. |  90   // find_text should not. | 
|  91   EXPECT_EQ(search_term3, FindPrepopulateText(web_contents())); |  91   EXPECT_EQ(search_term3, FindPrepopulateText(web_contents())); | 
|  92   EXPECT_EQ(search_term3, find_tab_helper->find_text()); |  92   EXPECT_EQ(search_term3, find_tab_helper->find_text()); | 
|  93   EXPECT_EQ(search_term3, FindPrepopulateText(contents2.get())); |  93   EXPECT_EQ(search_term3, FindPrepopulateText(contents2.get())); | 
|  94   EXPECT_EQ(search_term2, find_tab_helper2->find_text()); |  94   EXPECT_EQ(search_term2, find_tab_helper2->find_text()); | 
|  95 } |  95 } | 
| OLD | NEW |