blob: 48e39c5d80ccd0fff1a2b0b2e9108378172d689e [file] [log] [blame]
Greg Thompson85bd488c2017-06-08 09:18:111// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/active_use_util.h"
6
7#include "base/command_line.h"
8#include "base/files/file_path.h"
9#include "build/build_config.h"
10#include "chrome/common/chrome_switches.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
13TEST(ShouldRecordActiveUse, OrdinaryCommand) {
14 base::CommandLine cmd_line(base::FilePath(FILE_PATH_LITERAL("foo.exe")));
15#if !defined(OS_WIN) || defined(GOOGLE_CHROME_BUILD)
16 EXPECT_TRUE(ShouldRecordActiveUse(cmd_line));
17#else
18 EXPECT_FALSE(ShouldRecordActiveUse(cmd_line));
19#endif
20}
21
Greg Thompsondf00c4b2017-11-15 19:52:3422// --try-chrome-again by itself shouldn't do anything, just like the
23// OrdinaryCommand case.
24TEST(ShouldRecordActiveUse, FakeTryChromeAgainCommand) {
25 base::CommandLine cmd_line(base::FilePath(FILE_PATH_LITERAL("foo.exe")));
26 cmd_line.AppendSwitch(switches::kTryChromeAgain);
27#if !defined(OS_WIN) || defined(GOOGLE_CHROME_BUILD)
28 EXPECT_TRUE(ShouldRecordActiveUse(cmd_line));
29#else
30 EXPECT_FALSE(ShouldRecordActiveUse(cmd_line));
31#endif
32}
33
Greg Thompson85bd488c2017-06-08 09:18:1134TEST(ShouldRecordActiveUse, TryChromeAgainCommand) {
35 base::CommandLine cmd_line(base::FilePath(FILE_PATH_LITERAL("foo.exe")));
36 cmd_line.AppendSwitchASCII(switches::kTryChromeAgain, "0");
37
38 EXPECT_FALSE(ShouldRecordActiveUse(cmd_line));
39}