Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/printing/cloud_print/privet_notifications_unittest.cc

Issue 2797293002: Use ScopedTaskEnvironment instead of MessageLoop in chrome unit tests. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
10 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
11 #include "chrome/browser/notifications/notification_test_util.h" 12 #include "chrome/browser/notifications/notification_test_util.h"
12 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h " 13 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h "
13 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" 14 #include "chrome/browser/printing/cloud_print/privet_http_impl.h"
14 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "chrome/test/base/testing_profile_manager.h" 17 #include "chrome/test/base/testing_profile_manager.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "net/url_request/test_url_fetcher_factory.h" 19 #include "net/url_request/test_url_fetcher_factory.h"
19 #include "net/url_request/url_request_test_util.h" 20 #include "net/url_request/url_request_test_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 fetcher->set_status( 111 fetcher->set_status(
111 net::URLRequestStatus(net::URLRequestStatus::SUCCESS, net::OK)); 112 net::URLRequestStatus(net::URLRequestStatus::SUCCESS, net::OK));
112 fetcher->set_response_code(200); 113 fetcher->set_response_code(200);
113 fetcher->delegate()->OnURLFetchComplete(fetcher); 114 fetcher->delegate()->OnURLFetchComplete(fetcher);
114 return true; 115 return true;
115 } 116 }
116 117
117 protected: 118 protected:
118 StrictMock<MockPrivetNotificationsListenerDeleagate> mock_delegate_; 119 StrictMock<MockPrivetNotificationsListenerDeleagate> mock_delegate_;
119 std::unique_ptr<PrivetNotificationsListener> notification_listener_; 120 std::unique_ptr<PrivetNotificationsListener> notification_listener_;
120 base::MessageLoop message_loop_; 121 base::test::ScopedTaskEnvironment scoped_task_environment_;
121 scoped_refptr<net::TestURLRequestContextGetter> request_context_; 122 scoped_refptr<net::TestURLRequestContextGetter> request_context_;
122 net::TestURLFetcherFactory fetcher_factory_; 123 net::TestURLFetcherFactory fetcher_factory_;
123 DeviceDescription description_; 124 DeviceDescription description_;
124 }; 125 };
125 126
126 TEST_F(PrivetNotificationsListenerTest, DisappearReappearTest) { 127 TEST_F(PrivetNotificationsListenerTest, DisappearReappearTest) {
127 EXPECT_CALL(mock_delegate_, PrivetNotify(1, true)); 128 EXPECT_CALL(mock_delegate_, PrivetNotify(1, true));
128 notification_listener_->DeviceChanged(kExampleDeviceName, description_); 129 notification_listener_->DeviceChanged(kExampleDeviceName, description_);
129 EXPECT_TRUE(SuccessfulResponseToInfo(kInfoResponseUptime20)); 130 EXPECT_TRUE(SuccessfulResponseToInfo(kInfoResponseUptime20));
130 131
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 311
311 EXPECT_EQ("", service.open_tab_url().spec()); 312 EXPECT_EQ("", service.open_tab_url().spec());
312 EXPECT_EQ(0U, service.open_tab_count()); 313 EXPECT_EQ(0U, service.open_tab_count());
313 EXPECT_EQ(1U, service.disable_notifications_count()); 314 EXPECT_EQ(1U, service.disable_notifications_count());
314 EXPECT_EQ(0U, ui_manager()->GetNotificationCount()); 315 EXPECT_EQ(0U, ui_manager()->GetNotificationCount());
315 } 316 }
316 317
317 } // namespace 318 } // namespace
318 319
319 } // namespace cloud_print 320 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/local_domain_resolver_unittest.cc ('k') | chrome/browser/process_singleton_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698