summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_shelf_unittest.cc
blob: fd5dc84af9f005e5890a32cf5725907eaa6684f6 (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
// 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 "testing/gtest/include/gtest/gtest.h"

#include "base/compiler_specific.h"
#include "chrome/browser/download/test_download_shelf.h"

TEST(DownloadShelfTest, ClosesShelfWhenHidden) {
  TestDownloadShelf shelf;
  shelf.Show();
  EXPECT_TRUE(shelf.IsShowing());
  shelf.Hide();
  EXPECT_FALSE(shelf.IsShowing());
  shelf.Unhide();
  EXPECT_TRUE(shelf.IsShowing());
}

TEST(DownloadShelfTest, CloseWhileHiddenPreventsShowOnUnhide) {
  TestDownloadShelf shelf;
  shelf.Show();
  shelf.Hide();
  shelf.Close();
  shelf.Unhide();
  EXPECT_FALSE(shelf.IsShowing());
}

TEST(DownloadShelfTest, UnhideDoesntShowIfNotShownOnHide) {
  TestDownloadShelf shelf;
  shelf.Hide();
  shelf.Unhide();
  EXPECT_FALSE(shelf.IsShowing());
}

TEST(DownloadShelfTest, AddDownloadWhileHiddenUnhides) {
  TestDownloadShelf shelf;
  shelf.Show();
  shelf.Hide();
  shelf.AddDownload(NULL);
  EXPECT_TRUE(shelf.IsShowing());
}

TEST(DownloadShelfTest, AddDownloadWhileHiddenUnhidesAndShows) {
  TestDownloadShelf shelf;
  shelf.Hide();
  shelf.AddDownload(NULL);
  EXPECT_TRUE(shelf.IsShowing());
}