summaryrefslogtreecommitdiffstats
path: root/webkit/glue/web_intent_reply_data_unittest.cc
blob: a8aed519e3d851927fe8e62566f3aff3cb6e7cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <string>

#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/web_intent_reply_data.h"

using webkit_glue::WebIntentReply;

namespace {

TEST(WebIntentReplyDataTest, DefaultValues) {
  WebIntentReply reply;
  EXPECT_EQ(webkit_glue::WEB_INTENT_REPLY_INVALID, reply.type);
  EXPECT_EQ(string16(), reply.data);
  EXPECT_EQ(FilePath(), reply.data_file);
  EXPECT_EQ(-1, reply.data_file_size);
}

TEST(WebIntentReplyDataTest, Equality) {
  WebIntentReply data_a(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      ASCIIToUTF16("poodles"));

  WebIntentReply data_b(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      ASCIIToUTF16("poodles"));

  WebIntentReply data_c(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      ASCIIToUTF16("hamfancy"));

  EXPECT_EQ(data_a, data_b);
  EXPECT_FALSE(data_a == data_c || data_b == data_c);

  WebIntentReply file_a(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      FilePath(),
      22);

  WebIntentReply file_b(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      FilePath(),
      22);

  WebIntentReply file_c(
      webkit_glue::WEB_INTENT_REPLY_SUCCESS,
      FilePath(),
      17);

  EXPECT_EQ(file_a, file_b);
  EXPECT_FALSE(file_a == file_c || file_b == file_c);
}

}  // namespace