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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 IdleAppNameNotificationViewTest() | 23 IdleAppNameNotificationViewTest() |
24 : BrowserWithTestWindowTest( | 24 : BrowserWithTestWindowTest( |
25 Browser::TYPE_TABBED, | 25 Browser::TYPE_TABBED, |
26 chrome::HOST_DESKTOP_TYPE_ASH, | 26 chrome::HOST_DESKTOP_TYPE_ASH, |
27 false) { | 27 false) { |
28 } | 28 } |
29 | 29 |
30 virtual ~IdleAppNameNotificationViewTest() { | 30 virtual ~IdleAppNameNotificationViewTest() { |
31 } | 31 } |
32 | 32 |
33 virtual void SetUp() OVERRIDE { | 33 virtual void SetUp() override { |
34 // Add the application switch. | 34 // Add the application switch. |
35 CommandLine::ForCurrentProcess()->AppendSwitchASCII(::switches::kAppId, | 35 CommandLine::ForCurrentProcess()->AppendSwitchASCII(::switches::kAppId, |
36 kTestAppName); | 36 kTestAppName); |
37 | 37 |
38 BrowserWithTestWindowTest::SetUp(); | 38 BrowserWithTestWindowTest::SetUp(); |
39 | 39 |
40 base::DictionaryValue manifest; | 40 base::DictionaryValue manifest; |
41 manifest.SetString(extensions::manifest_keys::kName, "Test"); | 41 manifest.SetString(extensions::manifest_keys::kName, "Test"); |
42 manifest.SetString(extensions::manifest_keys::kVersion, "1"); | 42 manifest.SetString(extensions::manifest_keys::kVersion, "1"); |
43 manifest.SetString(extensions::manifest_keys::kDescription, "Test app"); | 43 manifest.SetString(extensions::manifest_keys::kDescription, "Test app"); |
(...skipping 14 matching lines...) Expand all Loading... |
58 | 58 |
59 incorrect_extension_ = | 59 incorrect_extension_ = |
60 extensions::Extension::Create(base::FilePath(), | 60 extensions::Extension::Create(base::FilePath(), |
61 extensions::Manifest::UNPACKED, | 61 extensions::Manifest::UNPACKED, |
62 manifest2, | 62 manifest2, |
63 extensions::Extension::NO_FLAGS, | 63 extensions::Extension::NO_FLAGS, |
64 kTestAppName, | 64 kTestAppName, |
65 &error); | 65 &error); |
66 } | 66 } |
67 | 67 |
68 virtual void TearDown() OVERRIDE { | 68 virtual void TearDown() override { |
69 // The destruction of the widget might be a delayed task. | 69 // The destruction of the widget might be a delayed task. |
70 base::MessageLoop::current()->RunUntilIdle(); | 70 base::MessageLoop::current()->RunUntilIdle(); |
71 BrowserWithTestWindowTest::TearDown(); | 71 BrowserWithTestWindowTest::TearDown(); |
72 } | 72 } |
73 | 73 |
74 extensions::Extension* correct_extension() { | 74 extensions::Extension* correct_extension() { |
75 return correct_extension_.get(); | 75 return correct_extension_.get(); |
76 } | 76 } |
77 extensions::Extension* incorrect_extension() { | 77 extensions::Extension* incorrect_extension() { |
78 return incorrect_extension_.get(); | 78 return incorrect_extension_.get(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Check that an invalid app gets shown accordingly. | 123 // Check that an invalid app gets shown accordingly. |
124 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { | 124 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { |
125 // Create a message which is visible for 10ms and fades in/out for 5ms. | 125 // Create a message which is visible for 10ms and fades in/out for 5ms. |
126 scoped_ptr<chromeos::IdleAppNameNotificationView> message( | 126 scoped_ptr<chromeos::IdleAppNameNotificationView> message( |
127 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); | 127 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); |
128 base::string16 text = message->GetShownTextForTest(); | 128 base::string16 text = message->GetShownTextForTest(); |
129 base::string16 error = l10n_util::GetStringUTF16( | 129 base::string16 error = l10n_util::GetStringUTF16( |
130 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); | 130 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); |
131 EXPECT_EQ(error, text); | 131 EXPECT_EQ(error, text); |
132 } | 132 } |
OLD | NEW |