Skip to content

Conversation

@CDRussell
Copy link
Member

Asana Issue URL: https://app.asana.com/0/488551667048375/518654221411512

Description

Implement Google Analytics surrogates to prevent some sites from breaking

Steps to Test this PR:

  1. Visit https://raspberrypi.org/
  2. Click "Buy a raspberry pi"
  3. Click "Buy now"
  4. Choose "element14"

If the site successfully loads, this is a good indicator the surrogate is working. For comparison, do the same in develop branch and confirm it doesn't work there.

Copy link
Contributor

@brindy brindy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just needs to be named more generically. A few comments inline.

* limitations under the License.
*/

package com.duckduckgo.app.analyticsSurrogates
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not keen on the name. Is this analytics as in google? The surrogates is more generic than that, it's just that's the main one we're targeting now.

Also a personal thing, but really dislike camel naming in packages but that's because I'm used to the Java conventions, though it seems Kotlin allows it (but discourages two words in a package name if possible).

Just surrogates would do imho :)

For reference:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming to simply surrogates

import org.junit.Before
import org.junit.Test

class AnalyticsSurrogatesLoaderTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, I think should drop Analytics in any of the names through out. (I won't flag any others)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace AnalyticsSurrogate with ResourceSurrogate throughout

@UiThreadTest
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to be mixing and matching approaches. Nothing to do here, but we should all perhaps have a chat about what the standard approach should be (I prefer just creating them directly without annotations or using initMocks personally).

fun before() {
mockDao = mock()
testee = HttpsUpgrader(mockDao)
testee = HttpsUpgraderImpl(mockDao)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The great implementation name debate. But nothing to change here, another one to discuss probably.

@@ -0,0 +1,107 @@
# To neutralize GA scripts. The goal is to provide the minimal API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these files are being served up by an endpoint for licensing issues. To avoid any problems can you create mock versions of these files, please?

Copy link
Contributor

@brindy brindy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@CDRussell CDRussell merged commit 601bbdb into develop Feb 1, 2018
@CDRussell CDRussell deleted the feature/google_analytics_surrogates branch February 1, 2018 15:47
aitorvs pushed a commit that referenced this pull request Nov 18, 2021
Co-authored-by: David González <malmstein@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants