OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/google/core/browser/google_url_tracker.h" | 5 #include "components/google/core/browser/google_url_tracker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | |
11 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
13 #include "base/prefs/testing_pref_service.h" | 12 #include "base/prefs/testing_pref_service.h" |
| 13 #include "base/thread_task_runner_handle.h" |
14 #include "components/google/core/browser/google_pref_names.h" | 14 #include "components/google/core/browser/google_pref_names.h" |
15 #include "components/google/core/browser/google_url_tracker_client.h" | 15 #include "components/google/core/browser/google_url_tracker_client.h" |
16 #include "net/url_request/test_url_fetcher_factory.h" | 16 #include "net/url_request/test_url_fetcher_factory.h" |
17 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
18 #include "net/url_request/url_request_test_util.h" | 18 #include "net/url_request/url_request_test_util.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // TestCallbackListener --------------------------------------------------- | 23 // TestCallbackListener --------------------------------------------------- |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 private: | 76 private: |
77 PrefService* prefs_; | 77 PrefService* prefs_; |
78 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 78 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); | 80 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); |
81 }; | 81 }; |
82 | 82 |
83 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(PrefService* prefs) | 83 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(PrefService* prefs) |
84 : prefs_(prefs), | 84 : prefs_(prefs), |
85 request_context_(new net::TestURLRequestContextGetter( | 85 request_context_(new net::TestURLRequestContextGetter( |
86 base::MessageLoopProxy::current())) { | 86 base::ThreadTaskRunnerHandle::Get())) { |
87 } | 87 } |
88 | 88 |
89 TestGoogleURLTrackerClient::~TestGoogleURLTrackerClient() { | 89 TestGoogleURLTrackerClient::~TestGoogleURLTrackerClient() { |
90 } | 90 } |
91 | 91 |
92 bool TestGoogleURLTrackerClient::IsBackgroundNetworkingEnabled() { | 92 bool TestGoogleURLTrackerClient::IsBackgroundNetworkingEnabled() { |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 PrefService* TestGoogleURLTrackerClient::GetPrefs() { | 96 PrefService* TestGoogleURLTrackerClient::GetPrefs() { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 EXPECT_TRUE(listener_notified()); | 342 EXPECT_TRUE(listener_notified()); |
343 clear_listener_notified(); | 343 clear_listener_notified(); |
344 | 344 |
345 RequestServerCheck(); | 345 RequestServerCheck(); |
346 // The second request should be ignored. | 346 // The second request should be ignored. |
347 EXPECT_FALSE(GetFetcher()); | 347 EXPECT_FALSE(GetFetcher()); |
348 MockSearchDomainCheckResponse(".google.co.in"); | 348 MockSearchDomainCheckResponse(".google.co.in"); |
349 EXPECT_EQ(GURL("https://www.google.co.uk/"), google_url()); | 349 EXPECT_EQ(GURL("https://www.google.co.uk/"), google_url()); |
350 EXPECT_FALSE(listener_notified()); | 350 EXPECT_FALSE(listener_notified()); |
351 } | 351 } |
OLD | NEW |