OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Unit tests for |FeedbackSender| object. | 5 // Unit tests for |FeedbackSender| object. |
6 | 6 |
7 #include "chrome/browser/spellchecker/feedback_sender.h" | 7 #include "chrome/browser/spellchecker/feedback_sender.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 std::string GetUploadData() const { | 135 std::string GetUploadData() const { |
136 const net::TestURLFetcher* fetcher = | 136 const net::TestURLFetcher* fetcher = |
137 fetchers_.GetFetcherByID(kUrlFetcherId); | 137 fetchers_.GetFetcherByID(kUrlFetcherId); |
138 return fetcher ? fetcher->upload_data() : std::string(); | 138 return fetcher ? fetcher->upload_data() : std::string(); |
139 } | 139 } |
140 | 140 |
141 scoped_ptr<spellcheck::FeedbackSender> feedback_; | 141 scoped_ptr<spellcheck::FeedbackSender> feedback_; |
142 | 142 |
143 private: | 143 private: |
| 144 base::MessageLoop loop_; |
144 TestingProfile profile_; | 145 TestingProfile profile_; |
145 base::MessageLoop loop_; | |
146 content::TestBrowserThread ui_thread_; | 146 content::TestBrowserThread ui_thread_; |
147 scoped_ptr<base::FieldTrialList> field_trial_list_; | 147 scoped_ptr<base::FieldTrialList> field_trial_list_; |
148 scoped_refptr<base::FieldTrial> field_trial_; | 148 scoped_refptr<base::FieldTrial> field_trial_; |
149 net::TestURLFetcherFactory fetchers_; | 149 net::TestURLFetcherFactory fetchers_; |
150 }; | 150 }; |
151 | 151 |
152 // Do not send data if there's no feedback. | 152 // Do not send data if there's no feedback. |
153 TEST_F(FeedbackSenderTest, NoFeedback) { | 153 TEST_F(FeedbackSenderTest, NoFeedback) { |
154 EXPECT_FALSE(IsUploadingData()); | 154 EXPECT_FALSE(IsUploadingData()); |
155 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, | 155 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 AddPendingFeedback(); | 615 AddPendingFeedback(); |
616 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, | 616 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, |
617 std::vector<uint32>()); | 617 std::vector<uint32>()); |
618 feedback_->StartFeedbackCollection(); | 618 feedback_->StartFeedbackCollection(); |
619 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, | 619 feedback_->OnReceiveDocumentMarkers(kRendererProcessId, |
620 std::vector<uint32>()); | 620 std::vector<uint32>()); |
621 EXPECT_FALSE(IsUploadingData()); | 621 EXPECT_FALSE(IsUploadingData()); |
622 } | 622 } |
623 | 623 |
624 } // namespace spellcheck | 624 } // namespace spellcheck |
OLD | NEW |