OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/printing/cloud_print/privet_notifications.h" | 5 #include "chrome/browser/printing/cloud_print/privet_notifications.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/test/scoped_task_environment.h" | |
11 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
12 #include "chrome/browser/notifications/notification_test_util.h" | 11 #include "chrome/browser/notifications/notification_test_util.h" |
13 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h
" | 12 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h
" |
14 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" | 13 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" |
15 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
16 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
17 #include "chrome/test/base/testing_profile_manager.h" | 16 #include "chrome/test/base/testing_profile_manager.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "net/url_request/test_url_fetcher_factory.h" | 18 #include "net/url_request/test_url_fetcher_factory.h" |
20 #include "net/url_request/url_request_test_util.h" | 19 #include "net/url_request/url_request_test_util.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 fetcher->set_status( | 110 fetcher->set_status( |
112 net::URLRequestStatus(net::URLRequestStatus::SUCCESS, net::OK)); | 111 net::URLRequestStatus(net::URLRequestStatus::SUCCESS, net::OK)); |
113 fetcher->set_response_code(200); | 112 fetcher->set_response_code(200); |
114 fetcher->delegate()->OnURLFetchComplete(fetcher); | 113 fetcher->delegate()->OnURLFetchComplete(fetcher); |
115 return true; | 114 return true; |
116 } | 115 } |
117 | 116 |
118 protected: | 117 protected: |
119 StrictMock<MockPrivetNotificationsListenerDeleagate> mock_delegate_; | 118 StrictMock<MockPrivetNotificationsListenerDeleagate> mock_delegate_; |
120 std::unique_ptr<PrivetNotificationsListener> notification_listener_; | 119 std::unique_ptr<PrivetNotificationsListener> notification_listener_; |
121 base::test::ScopedTaskEnvironment scoped_task_environment_; | 120 base::MessageLoop message_loop_; |
122 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 121 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
123 net::TestURLFetcherFactory fetcher_factory_; | 122 net::TestURLFetcherFactory fetcher_factory_; |
124 DeviceDescription description_; | 123 DeviceDescription description_; |
125 }; | 124 }; |
126 | 125 |
127 TEST_F(PrivetNotificationsListenerTest, DisappearReappearTest) { | 126 TEST_F(PrivetNotificationsListenerTest, DisappearReappearTest) { |
128 EXPECT_CALL(mock_delegate_, PrivetNotify(1, true)); | 127 EXPECT_CALL(mock_delegate_, PrivetNotify(1, true)); |
129 notification_listener_->DeviceChanged(kExampleDeviceName, description_); | 128 notification_listener_->DeviceChanged(kExampleDeviceName, description_); |
130 EXPECT_TRUE(SuccessfulResponseToInfo(kInfoResponseUptime20)); | 129 EXPECT_TRUE(SuccessfulResponseToInfo(kInfoResponseUptime20)); |
131 | 130 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 310 |
312 EXPECT_EQ("", service.open_tab_url().spec()); | 311 EXPECT_EQ("", service.open_tab_url().spec()); |
313 EXPECT_EQ(0U, service.open_tab_count()); | 312 EXPECT_EQ(0U, service.open_tab_count()); |
314 EXPECT_EQ(1U, service.disable_notifications_count()); | 313 EXPECT_EQ(1U, service.disable_notifications_count()); |
315 EXPECT_EQ(0U, ui_manager()->GetNotificationCount()); | 314 EXPECT_EQ(0U, ui_manager()->GetNotificationCount()); |
316 } | 315 } |
317 | 316 |
318 } // namespace | 317 } // namespace |
319 | 318 |
320 } // namespace cloud_print | 319 } // namespace cloud_print |
OLD | NEW |