Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: content/browser/service_worker/service_worker_version_unittest.cc

Issue 2485053002: Fix a failing service worker startup test to work with mojo IPC (Closed)
Patch Set: Remove the setter Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_version_unittest.cc
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc
index b8a5e89414c9f719780b45165f1a2d6ae52c2485..33f78fee8921c01549d78972e8dd85e344a7ccb1 100644
--- a/content/browser/service_worker/service_worker_version_unittest.cc
+++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -296,8 +296,8 @@ class ServiceWorkerVersionTestP
class MessageReceiverDisallowStart : public MessageReceiver {
public:
- MessageReceiverDisallowStart()
- : MessageReceiver() {}
+ MessageReceiverDisallowStart(bool is_mojo_enabled)
+ : MessageReceiver(), is_mojo_enabled_(is_mojo_enabled) {}
~MessageReceiverDisallowStart() override {}
enum class StartMode { STALL, FAIL, SUCCEED };
@@ -311,7 +311,14 @@ class MessageReceiverDisallowStart : public MessageReceiver {
case StartMode::STALL:
break; // Do nothing.
case StartMode::FAIL:
- OnStopWorker(embedded_worker_id);
+ if (is_mojo_enabled_) {
+ ASSERT_EQ(current_mock_instance_index_ + 1,
+ mock_instance_clients()->size());
+ // Remove the connection by peer
+ mock_instance_clients()->at(current_mock_instance_index_).reset();
+ } else {
+ OnStopWorker(embedded_worker_id);
+ }
break;
case StartMode::SUCCEED:
MessageReceiver::OnStartWorker(embedded_worker_id,
@@ -319,11 +326,14 @@ class MessageReceiverDisallowStart : public MessageReceiver {
script_url, pause_after_download);
break;
}
+ current_mock_instance_index_++;
}
void set_start_mode(StartMode mode) { mode_ = mode; }
private:
+ const bool is_mojo_enabled_;
+ uint32_t current_mock_instance_index_ = 0;
StartMode mode_ = StartMode::STALL;
DISALLOW_COPY_AND_ASSIGN(MessageReceiverDisallowStart);
};
@@ -339,7 +349,7 @@ class ServiceWorkerFailToStartTest : public ServiceWorkerVersionTestP {
}
std::unique_ptr<MessageReceiver> GetMessageReceiver() override {
- return base::MakeUnique<MessageReceiverDisallowStart>();
+ return base::MakeUnique<MessageReceiverDisallowStart>(is_mojo_enabled());
}
private:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698