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