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 "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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h" | 10 #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void ShowBookmarkPrompt() OVERRIDE { ++show_prompt_call_count_; } | 58 virtual void ShowBookmarkPrompt() OVERRIDE { ++show_prompt_call_count_; } |
59 int show_prompt_call_count_; | 59 int show_prompt_call_count_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(MyTestBrowserWindow); | 61 DISALLOW_COPY_AND_ASSIGN(MyTestBrowserWindow); |
62 }; | 62 }; |
63 | 63 |
64 virtual void SetUp() OVERRIDE { | 64 virtual void SetUp() OVERRIDE { |
65 TestingBrowserProcess::GetGlobal()-> | 65 TestingBrowserProcess::GetGlobal()-> |
66 SetBookmarkPromptController(new BookmarkPromptController); | 66 SetBookmarkPromptController(new BookmarkPromptController); |
67 BrowserWithTestWindowTest::SetUp(); | 67 BrowserWithTestWindowTest::SetUp(); |
68 ASSERT_TRUE(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 TestingBrowserProcess::GetGlobal()-> | 77 TestingBrowserProcess::GetGlobal()-> |
78 SetBookmarkPromptController(NULL); | 78 SetBookmarkPromptController(NULL); |
79 static_cast<TestingProfile*>(browser()->profile())-> | 79 static_cast<TestingProfile*>(browser()->profile())-> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 EXPECT_EQ(1, show_prompt_call_count()); | 132 EXPECT_EQ(1, show_prompt_call_count()); |
133 EXPECT_EQ(1, prefs.GetPromptImpressionCount()); | 133 EXPECT_EQ(1, prefs.GetPromptImpressionCount()); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 Visit(url); | 137 Visit(url); |
138 | 138 |
139 EXPECT_EQ(2, show_prompt_call_count()); | 139 EXPECT_EQ(2, show_prompt_call_count()); |
140 EXPECT_EQ(2, prefs.GetPromptImpressionCount()); | 140 EXPECT_EQ(2, prefs.GetPromptImpressionCount()); |
141 } | 141 } |
OLD | NEW |