| 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/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" | 9 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 0x09, 'm', 'y', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 0xc0, 0x0c, | 137 0x09, 'm', 'y', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 0xc0, 0x0c, |
| 138 0x00, 0x21, // Type is SRV | 138 0x00, 0x21, // Type is SRV |
| 139 0x00, 0x01, // CLASS is IN | 139 0x00, 0x01, // CLASS is IN |
| 140 0x00, 0x00, // TTL (4 bytes) is 0 seconds. | 140 0x00, 0x00, // TTL (4 bytes) is 0 seconds. |
| 141 0x00, 0x00, 0x00, 0x17, // RDLENGTH is 23 | 141 0x00, 0x00, 0x00, 0x17, // RDLENGTH is 23 |
| 142 0x00, 0x00, 0x00, 0x00, 0x22, 0xb8, // port 8888 | 142 0x00, 0x00, 0x00, 0x00, 0x22, 0xb8, // port 8888 |
| 143 0x09, 'm', 'y', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 0x05, 'l', | 143 0x09, 'm', 'y', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 0x05, 'l', |
| 144 'o', 'c', 'a', 'l', 0x00, | 144 'o', 'c', 'a', 'l', 0x00, |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 #if !defined(OS_WIN) || defined(NDEBUG) |
| 147 const uint8 kQueryPacket[] = { | 148 const uint8 kQueryPacket[] = { |
| 148 // Header | 149 // Header |
| 149 0x00, 0x00, // ID is zeroed out | 150 0x00, 0x00, // ID is zeroed out |
| 150 0x00, 0x00, // No flags. | 151 0x00, 0x00, // No flags. |
| 151 0x00, 0x01, // One question. | 152 0x00, 0x01, // One question. |
| 152 0x00, 0x00, // 0 RRs (answers) | 153 0x00, 0x00, // 0 RRs (answers) |
| 153 0x00, 0x00, // 0 authority RRs | 154 0x00, 0x00, // 0 authority RRs |
| 154 0x00, 0x00, // 0 additional RRs | 155 0x00, 0x00, // 0 additional RRs |
| 155 | 156 |
| 156 // Question | 157 // Question |
| 157 // This part is echoed back from the respective query. | 158 // This part is echoed back from the respective query. |
| 158 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', | 159 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', |
| 159 'p', 0x05, 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR. | 160 'p', 0x05, 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR. |
| 160 0x00, 0x01, // CLASS is IN. | 161 0x00, 0x01, // CLASS is IN. |
| 161 }; | 162 }; |
| 163 #endif // !defined(OS_WIN) || defined(NDEBUG) |
| 162 | 164 |
| 163 #endif // ENABLE_MDNS | 165 #endif // ENABLE_MDNS |
| 164 | 166 |
| 165 // Sentinel value to signify the request should fail. | 167 // Sentinel value to signify the request should fail. |
| 166 const char kResponseValueFailure[] = "FAILURE"; | 168 const char kResponseValueFailure[] = "FAILURE"; |
| 167 | 169 |
| 168 class FakeGCDApiFlowFactory | 170 class FakeGCDApiFlowFactory |
| 169 : public extensions::GcdPrivateAPI::GCDApiFlowFactoryForTests { | 171 : public extensions::GcdPrivateAPI::GCDApiFlowFactoryForTests { |
| 170 public: | 172 public: |
| 171 FakeGCDApiFlowFactory() { | 173 FakeGCDApiFlowFactory() { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 EXPECT_CALL(wifi_manager_factory_, WifiManagerCreated()) | 370 EXPECT_CALL(wifi_manager_factory_, WifiManagerCreated()) |
| 369 .WillOnce(Invoke(this, &GcdPrivateAPITest::OnCreateWifiManager)); | 371 .WillOnce(Invoke(this, &GcdPrivateAPITest::OnCreateWifiManager)); |
| 370 #endif | 372 #endif |
| 371 | 373 |
| 372 EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "wifi_password.html")); | 374 EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "wifi_password.html")); |
| 373 } | 375 } |
| 374 | 376 |
| 375 #endif // ENABLE_WIFI_BOOTSTRAPPING | 377 #endif // ENABLE_WIFI_BOOTSTRAPPING |
| 376 | 378 |
| 377 } // namespace | 379 } // namespace |
| OLD | NEW |