| 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_common.h" | 5 #include "components/feedback/feedback_common.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/feedback/proto/common.pb.h" | 8 #include "components/feedback/proto/common.pb.h" |
| 9 #include "components/feedback/proto/dom.pb.h" | 9 #include "components/feedback/proto/dom.pb.h" |
| 10 #include "components/feedback/proto/extension.pb.h" | 10 #include "components/feedback/proto/extension.pb.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const char kLongLog[] = TEN_LINES TEN_LINES TEN_LINES TEN_LINES TEN_LINES; | 21 const char kLongLog[] = TEN_LINES TEN_LINES TEN_LINES TEN_LINES TEN_LINES; |
| 22 const char kLogsAttachmentName[] = "system_logs.zip"; | 22 const char kLogsAttachmentName[] = "system_logs.zip"; |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 class FeedbackCommonTest : public testing::Test { | 25 class FeedbackCommonTest : public testing::Test { |
| 26 protected: | 26 protected: |
| 27 FeedbackCommonTest() { | 27 FeedbackCommonTest() { |
| 28 feedback = scoped_refptr<FeedbackCommon>(new FeedbackCommon()); | 28 feedback = scoped_refptr<FeedbackCommon>(new FeedbackCommon()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual ~FeedbackCommonTest() {} | 31 ~FeedbackCommonTest() override {} |
| 32 | 32 |
| 33 scoped_refptr<FeedbackCommon> feedback; | 33 scoped_refptr<FeedbackCommon> feedback; |
| 34 userfeedback::ExtensionSubmit report; | 34 userfeedback::ExtensionSubmit report; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 TEST_F(FeedbackCommonTest, TestBasicData) { | 37 TEST_F(FeedbackCommonTest, TestBasicData) { |
| 38 // Test that basic data can be set and propagates to the request. | 38 // Test that basic data can be set and propagates to the request. |
| 39 feedback->set_category_tag(kOne); | 39 feedback->set_category_tag(kOne); |
| 40 feedback->set_description(kTwo); | 40 feedback->set_description(kTwo); |
| 41 feedback->set_page_url(kThree); | 41 feedback->set_page_url(kThree); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 // Add a large and small log, verify that an attachment has been | 70 // Add a large and small log, verify that an attachment has been |
| 71 // added with the right name. | 71 // added with the right name. |
| 72 feedback->AddLog(kOne, kTwo); | 72 feedback->AddLog(kOne, kTwo); |
| 73 feedback->AddLog(kThree, kLongLog); | 73 feedback->AddLog(kThree, kLongLog); |
| 74 feedback->CompressLogs(); | 74 feedback->CompressLogs(); |
| 75 feedback->PrepareReport(&report); | 75 feedback->PrepareReport(&report); |
| 76 | 76 |
| 77 EXPECT_EQ(1, report.product_specific_binary_data_size()); | 77 EXPECT_EQ(1, report.product_specific_binary_data_size()); |
| 78 EXPECT_EQ(kLogsAttachmentName, report.product_specific_binary_data(0).name()); | 78 EXPECT_EQ(kLogsAttachmentName, report.product_specific_binary_data(0).name()); |
| 79 } | 79 } |
| OLD | NEW |