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

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc

Issue 11759019: Update other unittests to use newly added TestingBrowserProcess::GetGlobal(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simpler codez Created 7 years, 11 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 "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h" 9 #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 private: 55 private:
56 virtual bool IsActive() const OVERRIDE { return true; } 56 virtual bool IsActive() const OVERRIDE { return true; }
57 virtual void ShowBookmarkPrompt() OVERRIDE { ++show_prompt_call_count_; } 57 virtual void ShowBookmarkPrompt() OVERRIDE { ++show_prompt_call_count_; }
58 int show_prompt_call_count_; 58 int show_prompt_call_count_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(MyTestBrowserWindow); 60 DISALLOW_COPY_AND_ASSIGN(MyTestBrowserWindow);
61 }; 61 };
62 62
63 virtual void SetUp() OVERRIDE { 63 virtual void SetUp() OVERRIDE {
64 set_window(new MyTestBrowserWindow); 64 set_window(new MyTestBrowserWindow);
65 static_cast<TestingBrowserProcess*>(g_browser_process)-> 65 TestingBrowserProcess::GetGlobal()->
66 SetBookmarkPromptController(new BookmarkPromptController); 66 SetBookmarkPromptController(new BookmarkPromptController);
67 BrowserWithTestWindowTest::SetUp(); 67 BrowserWithTestWindowTest::SetUp();
68 static_cast<TestingProfile*>(browser()->profile())-> 68 static_cast<TestingProfile*>(browser()->profile())->
69 CreateHistoryService(true, false); 69 CreateHistoryService(true, false);
70 static_cast<TestingProfile*>(browser()->profile())-> 70 static_cast<TestingProfile*>(browser()->profile())->
71 BlockUntilHistoryIndexIsRefreshed(); 71 BlockUntilHistoryIndexIsRefreshed();
72 // Simulate browser activation. 72 // Simulate browser activation.
73 BrowserList::SetLastActive(browser()); 73 BrowserList::SetLastActive(browser());
74 } 74 }
75 75
76 virtual void TearDown() OVERRIDE { 76 virtual void TearDown() OVERRIDE {
77 static_cast<TestingBrowserProcess*>(g_browser_process)-> 77 TestingBrowserProcess::GetGlobal()->
78 SetBookmarkPromptController(NULL); 78 SetBookmarkPromptController(NULL);
79 static_cast<TestingProfile*>(browser()->profile())-> 79 static_cast<TestingProfile*>(browser()->profile())->
80 DestroyHistoryService(); 80 DestroyHistoryService();
81 BrowserWithTestWindowTest::TearDown(); 81 BrowserWithTestWindowTest::TearDown();
82 } 82 }
83 83
84 base::FieldTrialList field_trial_list_; 84 base::FieldTrialList field_trial_list_;
85 int page_id_; 85 int page_id_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(BookmarkPromptControllerTest); 87 DISALLOW_COPY_AND_ASSIGN(BookmarkPromptControllerTest);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(1, show_prompt_call_count()); 128 EXPECT_EQ(1, show_prompt_call_count());
129 EXPECT_EQ(1, prefs.GetPromptImpressionCount()); 129 EXPECT_EQ(1, prefs.GetPromptImpressionCount());
130 } 130 }
131 } 131 }
132 132
133 Visit(url); 133 Visit(url);
134 134
135 EXPECT_EQ(2, show_prompt_call_count()); 135 EXPECT_EQ(2, show_prompt_call_count());
136 EXPECT_EQ(2, prefs.GetPromptImpressionCount()); 136 EXPECT_EQ(2, prefs.GetPromptImpressionCount());
137 } 137 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_names_io_thread_unittest.cc ('k') | chrome/browser/ui/browser_command_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698