| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 public: | 74 public: |
| 75 TestGoogleURLTrackerClient(Profile* profile_); | 75 TestGoogleURLTrackerClient(Profile* profile_); |
| 76 virtual ~TestGoogleURLTrackerClient(); | 76 virtual ~TestGoogleURLTrackerClient(); |
| 77 | 77 |
| 78 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; | 78 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; |
| 79 virtual bool IsListeningForNavigationStart() OVERRIDE; | 79 virtual bool IsListeningForNavigationStart() OVERRIDE; |
| 80 virtual bool IsBackgroundNetworkingEnabled() OVERRIDE; | 80 virtual bool IsBackgroundNetworkingEnabled() OVERRIDE; |
| 81 virtual PrefService* GetPrefs() OVERRIDE; | 81 virtual PrefService* GetPrefs() OVERRIDE; |
| 82 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 82 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
| 83 virtual bool IsGoogleDomainURL(const GURL& url) OVERRIDE; | 83 virtual bool IsGoogleDomainURL(const GURL& url) OVERRIDE; |
| 84 virtual GURL AppendGoogleLocaleParam(const GURL& url) OVERRIDE; | |
| 85 | 84 |
| 86 private: | 85 private: |
| 87 Profile* profile_; | 86 Profile* profile_; |
| 88 bool observe_nav_start_; | 87 bool observe_nav_start_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); | 89 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(Profile* profile) | 92 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(Profile* profile) |
| 94 : profile_(profile), | 93 : profile_(profile), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 118 return profile_->GetRequestContext(); | 117 return profile_->GetRequestContext(); |
| 119 } | 118 } |
| 120 | 119 |
| 121 bool TestGoogleURLTrackerClient::IsGoogleDomainURL(const GURL& url) { | 120 bool TestGoogleURLTrackerClient::IsGoogleDomainURL(const GURL& url) { |
| 122 return google_util::IsGoogleDomainUrl( | 121 return google_util::IsGoogleDomainUrl( |
| 123 url, | 122 url, |
| 124 google_util::DISALLOW_SUBDOMAIN, | 123 google_util::DISALLOW_SUBDOMAIN, |
| 125 google_util::DISALLOW_NON_STANDARD_PORTS); | 124 google_util::DISALLOW_NON_STANDARD_PORTS); |
| 126 } | 125 } |
| 127 | 126 |
| 128 GURL TestGoogleURLTrackerClient::AppendGoogleLocaleParam(const GURL& url) { | |
| 129 return google_util::AppendGoogleLocaleParam(url); | |
| 130 } | |
| 131 | |
| 132 | 127 |
| 133 // TestGoogleURLTrackerNavigationHelper --------------------------------------- | 128 // TestGoogleURLTrackerNavigationHelper --------------------------------------- |
| 134 | 129 |
| 135 class TestGoogleURLTrackerNavigationHelper | 130 class TestGoogleURLTrackerNavigationHelper |
| 136 : public GoogleURLTrackerNavigationHelper { | 131 : public GoogleURLTrackerNavigationHelper { |
| 137 public: | 132 public: |
| 138 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); | 133 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); |
| 139 virtual ~TestGoogleURLTrackerNavigationHelper(); | 134 virtual ~TestGoogleURLTrackerNavigationHelper(); |
| 140 | 135 |
| 141 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE; | 136 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE; |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL); | 1048 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL); |
| 1054 GoogleURLTrackerInfoBarDelegate* delegate2 = | 1049 GoogleURLTrackerInfoBarDelegate* delegate2 = |
| 1055 GetInfoBarDelegate(&infobar_manager2); | 1050 GetInfoBarDelegate(&infobar_manager2); |
| 1056 ASSERT_FALSE(delegate2 == NULL); | 1051 ASSERT_FALSE(delegate2 == NULL); |
| 1057 SetNavigationPending(&infobar_manager, true); | 1052 SetNavigationPending(&infobar_manager, true); |
| 1058 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true)); | 1053 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true)); |
| 1059 delegate2->Close(false); | 1054 delegate2->Close(false); |
| 1060 SetNavigationPending(&infobar_manager, false); | 1055 SetNavigationPending(&infobar_manager, false); |
| 1061 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false)); | 1056 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false)); |
| 1062 } | 1057 } |
| OLD | NEW |