OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 void GoogleURLTrackerTest::SetUp() { | 156 void GoogleURLTrackerTest::SetUp() { |
157 original_default_request_context_ = Profile::GetDefaultRequestContext(); | 157 original_default_request_context_ = Profile::GetDefaultRequestContext(); |
158 Profile::set_default_request_context(NULL); | 158 Profile::set_default_request_context(NULL); |
159 message_loop_ = new MessageLoop(MessageLoop::TYPE_IO); | 159 message_loop_ = new MessageLoop(MessageLoop::TYPE_IO); |
160 io_thread_ = new BrowserThread(BrowserThread::IO, message_loop_); | 160 io_thread_ = new BrowserThread(BrowserThread::IO, message_loop_); |
161 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 161 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
162 testing_profile_.reset(new TestingProfile); | 162 testing_profile_.reset(new TestingProfile); |
163 TestingBrowserProcess* testing_browser_process = | 163 TestingBrowserProcess* testing_browser_process = |
164 static_cast<TestingBrowserProcess*>(g_browser_process); | 164 static_cast<TestingBrowserProcess*>(g_browser_process); |
165 PrefService* pref_service = testing_profile_->GetPrefs(); | 165 PrefService* pref_service = testing_profile_->GetLocalState(); |
166 testing_browser_process->SetPrefService(pref_service); | 166 testing_browser_process->SetPrefService(pref_service); |
167 GoogleURLTracker* tracker = new GoogleURLTracker; | 167 GoogleURLTracker* tracker = new GoogleURLTracker; |
168 tracker->queue_wakeup_task_ = false; | 168 tracker->queue_wakeup_task_ = false; |
169 MessageLoop::current()->RunAllPending(); | 169 MessageLoop::current()->RunAllPending(); |
170 testing_browser_process->SetGoogleURLTracker(tracker); | 170 testing_browser_process->SetGoogleURLTracker(tracker); |
171 | 171 |
172 URLFetcher::set_factory(&fetcher_factory_); | 172 URLFetcher::set_factory(&fetcher_factory_); |
173 g_browser_process->google_url_tracker()->infobar_creator_ = | 173 g_browser_process->google_url_tracker()->infobar_creator_ = |
174 &CreateTestInfobar; | 174 &CreateTestInfobar; |
175 } | 175 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 NavEntryCommitted(); | 482 NavEntryCommitted(); |
483 EXPECT_TRUE(InfoBarIsShown()); | 483 EXPECT_TRUE(InfoBarIsShown()); |
484 | 484 |
485 AcceptGoogleURL(); | 485 AcceptGoogleURL(); |
486 InfoBarClosed(); | 486 InfoBarClosed(); |
487 EXPECT_FALSE(InfoBarIsShown()); | 487 EXPECT_FALSE(InfoBarIsShown()); |
488 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); | 488 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); |
489 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); | 489 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); |
490 EXPECT_TRUE(observer_->notified()); | 490 EXPECT_TRUE(observer_->notified()); |
491 } | 491 } |
OLD | NEW |