-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable PushClientChannel #912
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include <stdint.h> | ||
|
||
#include <string> | ||
|
||
#include "base/compiler_specific.h" | ||
#include "base/memory/ptr_util.h" | ||
#include "components/invalidation/impl/push_client_channel.h" | ||
#include "jingle/notifier/listener/fake_push_client.h" | ||
#include "jingle/notifier/listener/notification_defines.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace syncer { | ||
namespace { | ||
|
||
class PushClientChannelTest | ||
: public ::testing::Test, | ||
public SyncNetworkChannel::Observer { | ||
protected: | ||
PushClientChannelTest() | ||
: fake_push_client_(new notifier::FakePushClient()), | ||
push_client_channel_(base::WrapUnique(fake_push_client_)) { | ||
push_client_channel_.AddObserver(this); | ||
push_client_channel_.SetMessageReceiver( | ||
invalidation::NewPermanentCallback( | ||
this, &PushClientChannelTest::OnIncomingMessage)); | ||
push_client_channel_.SetSystemResources(nullptr); | ||
} | ||
|
||
~PushClientChannelTest() override { | ||
push_client_channel_.RemoveObserver(this); | ||
} | ||
|
||
void OnNetworkChannelStateChanged( | ||
InvalidatorState invalidator_state) override { | ||
NOTREACHED(); | ||
} | ||
|
||
void OnIncomingMessage(std::string incoming_message) { | ||
NOTREACHED(); | ||
} | ||
|
||
notifier::FakePushClient* fake_push_client_; | ||
PushClientChannel push_client_channel_; | ||
}; | ||
|
||
const char kMessage[] = "message"; | ||
const char kServiceContext[] = "service context"; | ||
const int64_t kSchedulingHash = 100; | ||
|
||
// Simulate an incoming notification. Nothing should happen because | ||
// the channel should not be listening. | ||
TEST_F(PushClientChannelTest, OnIncomingMessage) { | ||
notifier::Notification notification; | ||
notification.data = | ||
PushClientChannel::EncodeMessageForTest( | ||
kMessage, kServiceContext, kSchedulingHash); | ||
fake_push_client_->SimulateIncomingNotification(notification); | ||
} | ||
|
||
} // namespace | ||
} // namespace syncer |
20 changes: 20 additions & 0 deletions
20
patches/components-invalidation-impl-push_client_channel.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/components/invalidation/impl/push_client_channel.cc b/components/invalidation/impl/push_client_channel.cc | ||
index 709d8e562c22..9170819bb45e 100644 | ||
--- a/components/invalidation/impl/push_client_channel.cc | ||
+++ b/components/invalidation/impl/push_client_channel.cc | ||
@@ -28,6 +28,7 @@ PushClientChannel::PushClientChannel( | ||
: push_client_(std::move(push_client)), | ||
scheduling_hash_(0), | ||
sent_messages_count_(0) { | ||
+ return; // feature disabled in Brave | ||
push_client_->AddObserver(this); | ||
notifier::Subscription subscription; | ||
subscription.channel = kChannelName; | ||
@@ -43,6 +44,7 @@ PushClientChannel::~PushClientChannel() { | ||
|
||
void PushClientChannel::UpdateCredentials( | ||
const std::string& email, const std::string& token) { | ||
+ return; // feature disabled in Brave | ||
net::NetworkTrafficAnnotationTag traffic_annotation = | ||
net::DefineNetworkTrafficAnnotation("puch_client_channel", R"( | ||
semantics { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these patches can also be removed with a chromium_src override on SyncNetworkChannel to subclass
PushClientChannel