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 "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" | 5 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/test_extension_system.h" | 10 #include "chrome/browser/extensions/test_extension_system.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
13 #include "chrome/test/base/browser_with_test_window_test.h" | 13 #include "chrome/test/base/browser_with_test_window_test.h" |
14 #include "extensions/common/manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 const char kTestAppName[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 18 const char kTestAppName[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 class IdleAppNameNotificationViewTest : public BrowserWithTestWindowTest { | 21 class IdleAppNameNotificationViewTest : public BrowserWithTestWindowTest { |
22 public: | 22 public: |
23 IdleAppNameNotificationViewTest() | 23 IdleAppNameNotificationViewTest() |
24 : BrowserWithTestWindowTest( | 24 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, |
25 Browser::TYPE_TABBED, | 25 ui::HOST_DESKTOP_TYPE_ASH, |
26 chrome::HOST_DESKTOP_TYPE_ASH, | 26 false) {} |
27 false) { | |
28 } | |
29 | 27 |
30 ~IdleAppNameNotificationViewTest() override {} | 28 ~IdleAppNameNotificationViewTest() override {} |
31 | 29 |
32 void SetUp() override { | 30 void SetUp() override { |
33 // Add the application switch. | 31 // Add the application switch. |
34 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 32 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
35 ::switches::kAppId, kTestAppName); | 33 ::switches::kAppId, kTestAppName); |
36 | 34 |
37 BrowserWithTestWindowTest::SetUp(); | 35 BrowserWithTestWindowTest::SetUp(); |
38 | 36 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Check that an invalid app gets shown accordingly. | 120 // Check that an invalid app gets shown accordingly. |
123 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { | 121 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { |
124 // Create a message which is visible for 10ms and fades in/out for 5ms. | 122 // Create a message which is visible for 10ms and fades in/out for 5ms. |
125 scoped_ptr<chromeos::IdleAppNameNotificationView> message( | 123 scoped_ptr<chromeos::IdleAppNameNotificationView> message( |
126 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); | 124 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); |
127 base::string16 text = message->GetShownTextForTest(); | 125 base::string16 text = message->GetShownTextForTest(); |
128 base::string16 error = l10n_util::GetStringUTF16( | 126 base::string16 error = l10n_util::GetStringUTF16( |
129 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); | 127 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); |
130 EXPECT_EQ(error, text); | 128 EXPECT_EQ(error, text); |
131 } | 129 } |
OLD | NEW |