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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 // TestGoogleURLTrackerClient ------------------------------------------------- | 110 // TestGoogleURLTrackerClient ------------------------------------------------- |
111 | 111 |
112 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient { | 112 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient { |
113 public: | 113 public: |
114 TestGoogleURLTrackerClient(); | 114 TestGoogleURLTrackerClient(); |
115 virtual ~TestGoogleURLTrackerClient(); | 115 virtual ~TestGoogleURLTrackerClient(); |
116 | 116 |
117 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; | 117 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; |
118 virtual bool IsListeningForNavigationStart() OVERRIDE; | 118 virtual bool IsListeningForNavigationStart() OVERRIDE; |
| 119 virtual bool IsBackgroundNetworkingEnabled() OVERRIDE; |
119 | 120 |
120 private: | 121 private: |
121 bool observe_nav_start_; | 122 bool observe_nav_start_; |
122 | 123 |
123 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); | 124 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); |
124 }; | 125 }; |
125 | 126 |
126 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient() | 127 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient() |
127 : observe_nav_start_(false) { | 128 : observe_nav_start_(false) { |
128 } | 129 } |
129 | 130 |
130 TestGoogleURLTrackerClient::~TestGoogleURLTrackerClient() { | 131 TestGoogleURLTrackerClient::~TestGoogleURLTrackerClient() { |
131 } | 132 } |
132 | 133 |
133 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { | 134 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { |
134 observe_nav_start_ = listen; | 135 observe_nav_start_ = listen; |
135 } | 136 } |
136 | 137 |
137 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() { | 138 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() { |
138 return observe_nav_start_; | 139 return observe_nav_start_; |
139 } | 140 } |
140 | 141 |
| 142 bool TestGoogleURLTrackerClient::IsBackgroundNetworkingEnabled() { |
| 143 return true; |
| 144 } |
| 145 |
141 | 146 |
142 // TestGoogleURLTrackerNavigationHelper --------------------------------------- | 147 // TestGoogleURLTrackerNavigationHelper --------------------------------------- |
143 | 148 |
144 class TestGoogleURLTrackerNavigationHelper | 149 class TestGoogleURLTrackerNavigationHelper |
145 : public GoogleURLTrackerNavigationHelper { | 150 : public GoogleURLTrackerNavigationHelper { |
146 public: | 151 public: |
147 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); | 152 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); |
148 virtual ~TestGoogleURLTrackerNavigationHelper(); | 153 virtual ~TestGoogleURLTrackerNavigationHelper(); |
149 | 154 |
150 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE; | 155 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE; |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); | 1110 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); |
1106 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL); | 1111 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL); |
1107 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2); | 1112 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2); |
1108 ASSERT_FALSE(delegate2 == NULL); | 1113 ASSERT_FALSE(delegate2 == NULL); |
1109 SetNavigationPending(1, true); | 1114 SetNavigationPending(1, true); |
1110 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); | 1115 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); |
1111 delegate2->Close(false); | 1116 delegate2->Close(false); |
1112 SetNavigationPending(1, false); | 1117 SetNavigationPending(1, false); |
1113 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); | 1118 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); |
1114 } | 1119 } |
OLD | NEW |