OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, SyncEventInterface) { | 1147 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, SyncEventInterface) { |
1148 // Verify that the fired sync event has the correct interface. | 1148 // Verify that the fired sync event has the correct interface. |
1149 // The js event handler will console.log the event properties. | 1149 // The js event handler will console.log the event properties. |
1150 base::string16 console_output = RunSyncTestWithConsoleOutput( | 1150 base::string16 console_output = RunSyncTestWithConsoleOutput( |
1151 "/background_sync/sync_event_interface.js", SERVICE_WORKER_OK); | 1151 "/background_sync/sync_event_interface.js", SERVICE_WORKER_OK); |
1152 | 1152 |
1153 EXPECT_FALSE(console_output.empty()); | 1153 EXPECT_FALSE(console_output.empty()); |
1154 | 1154 |
1155 // Console output is a pipe-delimited string, as: | 1155 // Console output is a pipe-delimited string, as: |
1156 // <event prototype>|<typeof waitUntil> | 1156 // <event prototype>|<typeof waitUntil> |
1157 std::vector<base::string16> event_properties; | 1157 std::vector<base::string16> event_properties = |
1158 base::SplitString(console_output, '|', &event_properties); | 1158 base::SplitString(console_output, base::string16(1, '|'), |
| 1159 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
1159 | 1160 |
1160 const base::string16::size_type num_properties = 2; | 1161 const base::string16::size_type num_properties = 2; |
1161 const base::string16 event_type = base::ASCIIToUTF16("SyncEvent"); | 1162 const base::string16 event_type = base::ASCIIToUTF16("SyncEvent"); |
1162 const base::string16 wait_until_type = base::ASCIIToUTF16("function"); | 1163 const base::string16 wait_until_type = base::ASCIIToUTF16("function"); |
1163 EXPECT_EQ(num_properties, event_properties.size()); | 1164 EXPECT_EQ(num_properties, event_properties.size()); |
1164 EXPECT_EQ(event_type, event_properties[0]); | 1165 EXPECT_EQ(event_type, event_properties[0]); |
1165 EXPECT_EQ(wait_until_type, event_properties[1]); | 1166 EXPECT_EQ(wait_until_type, event_properties[1]); |
1166 } | 1167 } |
1167 | 1168 |
1168 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, | 1169 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 ASSERT_EQ(SERVICE_WORKER_OK, status); | 1528 ASSERT_EQ(SERVICE_WORKER_OK, status); |
1528 // Stop the worker. | 1529 // Stop the worker. |
1529 StopWorker(SERVICE_WORKER_OK); | 1530 StopWorker(SERVICE_WORKER_OK); |
1530 // Restart the worker. | 1531 // Restart the worker. |
1531 StartWorker(SERVICE_WORKER_OK); | 1532 StartWorker(SERVICE_WORKER_OK); |
1532 // Stop the worker. | 1533 // Stop the worker. |
1533 StopWorker(SERVICE_WORKER_OK); | 1534 StopWorker(SERVICE_WORKER_OK); |
1534 } | 1535 } |
1535 | 1536 |
1536 } // namespace content | 1537 } // namespace content |
OLD | NEW |