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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { return correct_extension_; } | 74 extensions::Extension* correct_extension() { |
75 extensions::Extension* incorrect_extension() { return incorrect_extension_; } | 75 return correct_extension_.get(); |
| 76 } |
| 77 extensions::Extension* incorrect_extension() { |
| 78 return incorrect_extension_.get(); |
| 79 } |
76 | 80 |
77 private: | 81 private: |
78 // Extensions to test with. | 82 // Extensions to test with. |
79 scoped_refptr<extensions::Extension> correct_extension_; | 83 scoped_refptr<extensions::Extension> correct_extension_; |
80 scoped_refptr<extensions::Extension> incorrect_extension_; | 84 scoped_refptr<extensions::Extension> incorrect_extension_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(IdleAppNameNotificationViewTest); | 86 DISALLOW_COPY_AND_ASSIGN(IdleAppNameNotificationViewTest); |
83 }; | 87 }; |
84 | 88 |
85 // Check that creating and immediate destroying does not crash (and closes the | 89 // Check that creating and immediate destroying does not crash (and closes the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Check that an invalid app gets shown accordingly. | 123 // Check that an invalid app gets shown accordingly. |
120 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { | 124 TEST_F(IdleAppNameNotificationViewTest, CheckInvalidApp) { |
121 // 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. |
122 scoped_ptr<chromeos::IdleAppNameNotificationView> message( | 126 scoped_ptr<chromeos::IdleAppNameNotificationView> message( |
123 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); | 127 new chromeos::IdleAppNameNotificationView(10, 5, NULL)); |
124 base::string16 text = message->GetShownTextForTest(); | 128 base::string16 text = message->GetShownTextForTest(); |
125 base::string16 error = l10n_util::GetStringUTF16( | 129 base::string16 error = l10n_util::GetStringUTF16( |
126 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); | 130 IDS_IDLE_APP_NAME_UNKNOWN_APPLICATION_NOTIFICATION); |
127 EXPECT_EQ(error, text); | 131 EXPECT_EQ(error, text); |
128 } | 132 } |
OLD | NEW |