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

Unified Diff: content/child/background_sync/background_sync_type_converters_unittest.cc

Issue 2473483012: Move content/child/background_sync to Blink. (Closed)
Patch Set: Update OWNERS to make presubmit happy 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
Index: content/child/background_sync/background_sync_type_converters_unittest.cc
diff --git a/content/child/background_sync/background_sync_type_converters_unittest.cc b/content/child/background_sync/background_sync_type_converters_unittest.cc
index b822bdf53ffde9fc6099c395e05575e5177bb258..7035c966d5f04242cfb1db978e6aea8d7100fe6d 100644
--- a/content/child/background_sync/background_sync_type_converters_unittest.cc
+++ b/content/child/background_sync/background_sync_type_converters_unittest.cc
@@ -10,77 +10,17 @@
namespace mojo {
namespace {
-TEST(BackgroundSyncTypeConverterTest, TestBlinkToMojoNetworkStateConversions) {
- ASSERT_EQ(blink::WebSyncRegistration::NetworkStateAny,
- ConvertTo<blink::WebSyncRegistration::NetworkState>(
- blink::mojom::BackgroundSyncNetworkState::ANY));
- ASSERT_EQ(blink::WebSyncRegistration::NetworkStateAvoidCellular,
- ConvertTo<blink::WebSyncRegistration::NetworkState>(
- blink::mojom::BackgroundSyncNetworkState::AVOID_CELLULAR));
- ASSERT_EQ(blink::WebSyncRegistration::NetworkStateOnline,
- ConvertTo<blink::WebSyncRegistration::NetworkState>(
- blink::mojom::BackgroundSyncNetworkState::ONLINE));
+TEST(BackgroundSyncTypeConverterTest, TestBlinkToMojoLastChanceOption) {
+ ASSERT_EQ(blink::mojom::BackgroundSyncEventLastChance::IS_NOT_LAST_CHANCE,
+ ConvertTo<blink::mojom::BackgroundSyncEventLastChance>(
+ blink::WebServiceWorkerContextProxy::IsNotLastChance));
}
-TEST(BackgroundSyncTypeConverterTest, TestMojoToBlinkNetworkStateConversions) {
- ASSERT_EQ(blink::mojom::BackgroundSyncNetworkState::ANY,
- ConvertTo<blink::mojom::BackgroundSyncNetworkState>(
- blink::WebSyncRegistration::NetworkStateAny));
- ASSERT_EQ(blink::mojom::BackgroundSyncNetworkState::AVOID_CELLULAR,
- ConvertTo<blink::mojom::BackgroundSyncNetworkState>(
- blink::WebSyncRegistration::NetworkStateAvoidCellular));
- ASSERT_EQ(blink::mojom::BackgroundSyncNetworkState::ONLINE,
- ConvertTo<blink::mojom::BackgroundSyncNetworkState>(
- blink::WebSyncRegistration::NetworkStateOnline));
-}
-
-TEST(BackgroundSyncTypeConverterTest, TestDefaultBlinkToMojoConversion) {
- blink::WebSyncRegistration in;
- blink::mojom::SyncRegistrationPtr out =
- ConvertTo<blink::mojom::SyncRegistrationPtr>(in);
-
- ASSERT_EQ(blink::WebSyncRegistration::UNREGISTERED_SYNC_ID, out->id);
- ASSERT_EQ("", out->tag);
- ASSERT_EQ(blink::mojom::BackgroundSyncNetworkState::ONLINE,
- out->network_state);
-}
-
-TEST(BackgroundSyncTypeConverterTest, TestFullBlinkToMojoConversion) {
- blink::WebSyncRegistration in(
- 7, "BlinkToMojo", blink::WebSyncRegistration::NetworkStateAvoidCellular);
- blink::mojom::SyncRegistrationPtr out =
- ConvertTo<blink::mojom::SyncRegistrationPtr>(in);
-
- ASSERT_EQ(7, out->id);
- ASSERT_EQ("BlinkToMojo", out->tag);
- ASSERT_EQ(blink::mojom::BackgroundSyncNetworkState::AVOID_CELLULAR,
- out->network_state);
-}
-
-TEST(BackgroundSyncTypeConverterTest, TestDefaultMojoToBlinkConversion) {
- blink::mojom::SyncRegistrationPtr in(blink::mojom::SyncRegistration::New());
- std::unique_ptr<blink::WebSyncRegistration> out =
- ConvertTo<std::unique_ptr<blink::WebSyncRegistration>>(in);
-
- ASSERT_EQ(blink::WebSyncRegistration::UNREGISTERED_SYNC_ID, out->id);
- ASSERT_EQ("",out->tag);
- ASSERT_EQ(blink::WebSyncRegistration::NetworkStateOnline, out->networkState);
-}
-
-TEST(BackgroundSyncTypeConverterTest, TestFullMojoToBlinkConversion) {
- blink::mojom::SyncRegistrationPtr in(blink::mojom::SyncRegistration::New());
- in->id = 41;
- in->tag = mojo::String("MojoToBlink");
- in->network_state = blink::mojom::BackgroundSyncNetworkState::AVOID_CELLULAR;
- std::unique_ptr<blink::WebSyncRegistration> out =
- ConvertTo<std::unique_ptr<blink::WebSyncRegistration>>(in);
-
- ASSERT_EQ(41, out->id);
- ASSERT_EQ("MojoToBlink", out->tag.utf8());
- ASSERT_EQ(blink::WebSyncRegistration::NetworkStateAvoidCellular,
- out->networkState);
+TEST(BackgroundSyncTypeConverterTest, TestMojoToBlinkLastChanceOption) {
+ ASSERT_EQ(blink::WebServiceWorkerContextProxy::IsLastChance,
+ ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>(
+ blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE));
}
} // anonymous namespace
} // namespace mojo
-

Powered by Google App Engine
This is Rietveld 408576698