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 "components/feedback/feedback_data.h" | 5 #include "components/feedback/feedback_data.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "components/feedback/feedback_uploader.h" | 14 #include "components/feedback/feedback_uploader.h" |
15 #include "components/feedback/feedback_uploader_factory.h" | 15 #include "components/feedback/feedback_uploader_factory.h" |
16 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
17 #include "components/prefs/testing_pref_service.h" | 17 #include "components/prefs/testing_pref_service.h" |
18 #include "components/user_prefs/user_prefs.h" | 18 #include "components/user_prefs/user_prefs.h" |
19 #include "content/public/test/test_browser_context.h" | 19 #include "content/public/test/test_browser_context.h" |
20 #include "content/public/test/test_browser_thread.h" | 20 #include "content/public/test/test_browser_thread.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kHistograms[] = ""; | 26 const char kHistograms[] = ""; |
27 const char kImageData[] = ""; | 27 const char kImageData[] = ""; |
28 const char kFileData[] = ""; | 28 const char kFileData[] = ""; |
29 | 29 |
30 const base::TimeDelta kRetryDelayForTest = | |
31 base::TimeDelta::FromMilliseconds(100); | |
32 | |
33 using content::BrowserThread; | 30 using content::BrowserThread; |
34 | 31 |
35 class MockUploader : public feedback::FeedbackUploader, public KeyedService { | 32 class MockUploader : public feedback::FeedbackUploader, public KeyedService { |
36 public: | 33 public: |
37 MockUploader(content::BrowserContext* context) | 34 MockUploader(content::BrowserContext* context) |
38 : FeedbackUploader(context ? context->GetPath() : base::FilePath(), | 35 : FeedbackUploader(context ? context->GetPath() : base::FilePath(), |
39 BrowserThread::GetBlockingPool()) {} | 36 BrowserThread::GetBlockingPool()) {} |
40 | 37 |
41 MOCK_METHOD1(DispatchReport, void(const std::string&)); | 38 MOCK_METHOD1(DispatchReport, void(const std::string&)); |
42 }; | 39 }; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 TEST_F(FeedbackDataTest, ReportSending) { | 102 TEST_F(FeedbackDataTest, ReportSending) { |
106 data_->SetAndCompressHistograms(MakeScoped(kHistograms)); | 103 data_->SetAndCompressHistograms(MakeScoped(kHistograms)); |
107 data_->set_image(MakeScoped(kImageData)); | 104 data_->set_image(MakeScoped(kImageData)); |
108 data_->AttachAndCompressFileData(MakeScoped(kFileData)); | 105 data_->AttachAndCompressFileData(MakeScoped(kFileData)); |
109 Send(); | 106 Send(); |
110 RunMessageLoop(); | 107 RunMessageLoop(); |
111 EXPECT_TRUE(data_->IsDataComplete()); | 108 EXPECT_TRUE(data_->IsDataComplete()); |
112 } | 109 } |
113 | 110 |
114 } // namespace feedback | 111 } // namespace feedback |
OLD | NEW |