OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 6 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 // A test that makes sure we properly save the client id we were passed when | 51 // A test that makes sure we properly save the client id we were passed when |
52 // the app called the getNotificationChannel API. | 52 // the app called the getNotificationChannel API. |
53 IN_PROC_BROWSER_TEST_F(AppNotificationTest, SaveClientId) { | 53 IN_PROC_BROWSER_TEST_F(AppNotificationTest, SaveClientId) { |
54 Interceptor interceptor; | 54 Interceptor interceptor; |
55 AppNotifyChannelSetup::SetInterceptorForTests(&interceptor); | 55 AppNotifyChannelSetup::SetInterceptorForTests(&interceptor); |
56 | 56 |
57 const Extension* app = | 57 const extensions::Extension* app = |
58 LoadExtension(test_data_dir_.AppendASCII("app_notifications")); | 58 LoadExtension(test_data_dir_.AppendASCII("app_notifications")); |
59 ASSERT_TRUE(app != NULL); | 59 ASSERT_TRUE(app != NULL); |
60 | 60 |
61 Browser::OpenApplication(browser()->profile(), | 61 Browser::OpenApplication(browser()->profile(), |
62 app, | 62 app, |
63 extension_misc::LAUNCH_TAB, | 63 extension_misc::LAUNCH_TAB, |
64 GURL(), | 64 GURL(), |
65 NEW_FOREGROUND_TAB); | 65 NEW_FOREGROUND_TAB); |
66 if (!interceptor.was_called()) | 66 if (!interceptor.was_called()) |
67 ui_test_utils::RunMessageLoop(); | 67 ui_test_utils::RunMessageLoop(); |
68 EXPECT_TRUE(interceptor.was_called()); | 68 EXPECT_TRUE(interceptor.was_called()); |
69 | 69 |
70 ExtensionService* service = browser()->profile()->GetExtensionService(); | 70 ExtensionService* service = browser()->profile()->GetExtensionService(); |
71 ExtensionPrefs* prefs = service->extension_prefs(); | 71 ExtensionPrefs* prefs = service->extension_prefs(); |
72 std::string saved_id = prefs->GetAppNotificationClientId(app->id()); | 72 std::string saved_id = prefs->GetAppNotificationClientId(app->id()); |
73 EXPECT_EQ(kExpectedClientId, saved_id); | 73 EXPECT_EQ(kExpectedClientId, saved_id); |
74 } | 74 } |
OLD | NEW |