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

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

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 7 years, 6 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) 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/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_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"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
13 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/test/test_browser_thread.h"
16 #include "content/public/test/web_contents_tester.h" 15 #include "content/public/test/web_contents_tester.h"
17 16
18 using content::BrowserThread;
19 using content::WebContents; 17 using content::WebContents;
20 using content::WebContentsTester; 18 using content::WebContentsTester;
21 19
22 class FindBackendTest : public ChromeRenderViewHostTestHarness { 20 class FindBackendTest : public ChromeRenderViewHostTestHarness {
23 public: 21 protected:
24 FindBackendTest()
25 : ChromeRenderViewHostTestHarness(),
26 browser_thread_(BrowserThread::UI, &message_loop_) {}
27
28 private:
29 virtual void SetUp() OVERRIDE { 22 virtual void SetUp() OVERRIDE {
30 ChromeRenderViewHostTestHarness::SetUp(); 23 ChromeRenderViewHostTestHarness::SetUp();
31 FindTabHelper::CreateForWebContents(web_contents()); 24 FindTabHelper::CreateForWebContents(web_contents());
32 } 25 }
33
34 content::TestBrowserThread browser_thread_;
35 }; 26 };
36 27
37 namespace { 28 namespace {
38 29
39 string16 FindPrepopulateText(WebContents* contents) { 30 string16 FindPrepopulateText(WebContents* contents) {
40 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 31 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
41 return FindBarStateFactory::GetLastPrepopulateText(profile); 32 return FindBarStateFactory::GetLastPrepopulateText(profile);
42 } 33 }
43 34
44 } // end namespace 35 } // end namespace
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // find_tab_helper (as indicated by the last two params). 86 // find_tab_helper (as indicated by the last two params).
96 find_tab_helper->StartFinding(search_term3, true, false); 87 find_tab_helper->StartFinding(search_term3, true, false);
97 88
98 // 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
99 // find_text should not. 90 // find_text should not.
100 EXPECT_EQ(search_term3, FindPrepopulateText(web_contents())); 91 EXPECT_EQ(search_term3, FindPrepopulateText(web_contents()));
101 EXPECT_EQ(search_term3, find_tab_helper->find_text()); 92 EXPECT_EQ(search_term3, find_tab_helper->find_text());
102 EXPECT_EQ(search_term3, FindPrepopulateText(contents2.get())); 93 EXPECT_EQ(search_term3, FindPrepopulateText(contents2.get()));
103 EXPECT_EQ(search_term2, find_tab_helper2->find_text()); 94 EXPECT_EQ(search_term2, find_tab_helper2->find_text());
104 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698