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/local_discovery/privetv3_session.h" | 5 #include "chrome/browser/local_discovery/privetv3_session.h" |
6 | 6 |
7 #include "chrome/browser/local_discovery/privet_http.h" | 7 #include "chrome/browser/local_discovery/privet_http.h" |
8 #include "content/public/test/test_utils.h" | 8 #include "content/public/test/test_utils.h" |
9 #include "net/url_request/test_url_fetcher_factory.h" | 9 #include "net/url_request/test_url_fetcher_factory.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 void QuitLoop() { | 37 void QuitLoop() { |
38 base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_); | 38 base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_); |
39 } | 39 } |
40 | 40 |
41 void ConfirmCode(const std::string& code, | 41 void ConfirmCode(const std::string& code, |
42 extensions::api::gcd_private::ConfirmationType type) { | 42 extensions::api::gcd_private::ConfirmationType type) { |
43 session_.ConfirmCode(code); | 43 session_.ConfirmCode(code); |
44 } | 44 } |
45 | 45 |
46 protected: | 46 protected: |
47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() override { |
48 quit_closure_ = run_loop_.QuitClosure(); | 48 quit_closure_ = run_loop_.QuitClosure(); |
49 EXPECT_CALL(delegate_, OnSetupConfirmationNeeded(_, _)).Times(0); | 49 EXPECT_CALL(delegate_, OnSetupConfirmationNeeded(_, _)).Times(0); |
50 EXPECT_CALL(delegate_, OnSessionStatus(_)).Times(0); | 50 EXPECT_CALL(delegate_, OnSessionStatus(_)).Times(0); |
51 } | 51 } |
52 | 52 |
53 StrictMock<MockDelegate> delegate_; | 53 StrictMock<MockDelegate> delegate_; |
54 PrivetV3Session session_; | 54 PrivetV3Session session_; |
55 base::MessageLoop loop_; | 55 base::MessageLoop loop_; |
56 base::RunLoop run_loop_; | 56 base::RunLoop run_loop_; |
57 base::Closure quit_closure_; | 57 base::Closure quit_closure_; |
(...skipping 13 matching lines...) Expand all Loading... |
71 .WillOnce(InvokeWithoutArgs(this, &PrivetV3SessionTest::QuitLoop)); | 71 .WillOnce(InvokeWithoutArgs(this, &PrivetV3SessionTest::QuitLoop)); |
72 EXPECT_CALL(delegate_, OnSetupConfirmationNeeded(_, _)).Times(1).WillOnce( | 72 EXPECT_CALL(delegate_, OnSetupConfirmationNeeded(_, _)).Times(1).WillOnce( |
73 Invoke(this, &PrivetV3SessionTest::ConfirmCode)); | 73 Invoke(this, &PrivetV3SessionTest::ConfirmCode)); |
74 session_.Start(); | 74 session_.Start(); |
75 run_loop_.Run(); | 75 run_loop_.Run(); |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 } // namespace local_discovery | 80 } // namespace local_discovery |
OLD | NEW |