| 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 "chrome/browser/copresence/chrome_whispernet_client.h" | 5 #include "chrome/browser/copresence/chrome_whispernet_client.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 return buffer; | 46 return buffer; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 class ChromeWhispernetClientTest : public ExtensionBrowserTest { | 51 class ChromeWhispernetClientTest : public ExtensionBrowserTest { |
| 52 public: | 52 public: |
| 53 ChromeWhispernetClientTest() : context_(NULL), initialized_(false) {} | 53 ChromeWhispernetClientTest() : context_(NULL), initialized_(false) {} |
| 54 | 54 |
| 55 virtual ~ChromeWhispernetClientTest() {} | 55 ~ChromeWhispernetClientTest() override {} |
| 56 | 56 |
| 57 void InitializeWhispernet() { | 57 void InitializeWhispernet() { |
| 58 context_ = browser()->profile(); | 58 context_ = browser()->profile(); |
| 59 run_loop_.reset(new base::RunLoop()); | 59 run_loop_.reset(new base::RunLoop()); |
| 60 GetWhispernetClient(context_)->Initialize(base::Bind( | 60 GetWhispernetClient(context_)->Initialize(base::Bind( |
| 61 &ChromeWhispernetClientTest::InitCallback, base::Unretained(this))); | 61 &ChromeWhispernetClientTest::InitCallback, base::Unretained(this))); |
| 62 run_loop_->Run(); | 62 run_loop_->Run(); |
| 63 | 63 |
| 64 EXPECT_TRUE(initialized_); | 64 EXPECT_TRUE(initialized_); |
| 65 } | 65 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 EncodeTokenAndSaveSamples(false); | 188 EncodeTokenAndSaveSamples(false); |
| 189 DecodeSamplesAndVerifyToken(false); | 189 DecodeSamplesAndVerifyToken(false); |
| 190 DetectBroadcast(); | 190 DetectBroadcast(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, Audible) { | 193 IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, Audible) { |
| 194 InitializeWhispernet(); | 194 InitializeWhispernet(); |
| 195 EncodeTokenAndSaveSamples(true); | 195 EncodeTokenAndSaveSamples(true); |
| 196 DecodeSamplesAndVerifyToken(true); | 196 DecodeSamplesAndVerifyToken(true); |
| 197 } | 197 } |
| OLD | NEW |