Merge lp:~marcustomlinson/unity-scopes-api/oa_ui_policy-rtm into lp:unity-scopes-api/rtm-14.09

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 252
Merged at revision: 257
Proposed branch: lp:~marcustomlinson/unity-scopes-api/oa_ui_policy-rtm
Merge into: lp:unity-scopes-api/rtm-14.09
Diff against target: 97 lines (+24/-44)
2 files modified
src/scopes/internal/OnlineAccountClientImpl.cpp (+24/-1)
test/gtest/scopes/OnlineAccountClient/OnlineAccountClient_test.cpp (+0/-43)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/oa_ui_policy-rtm
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
Review via email: mp+244386@code.launchpad.net

Commit message

* Use SIGNON_POLICY_NO_USER_INTERACTION by default unless UNITY_SCOPES_OA_UI_POLICY env var is set.
* Update the accounts we already know about when refresh_service_statuses() is called.

To post a comment you must log in.
Revision history for this message
Paweł Stołowski (stolowski) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scopes/internal/OnlineAccountClientImpl.cpp'
2--- src/scopes/internal/OnlineAccountClientImpl.cpp 2014-10-13 15:13:12 +0000
3+++ src/scopes/internal/OnlineAccountClientImpl.cpp 2014-12-11 09:00:52 +0000
4@@ -160,8 +160,24 @@
5 }
6
7 // Get authorization parameters then attempt to signon
8+ GVariantBuilder builder;
9+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
10+
11+ if (getenv("UNITY_SCOPES_OA_UI_POLICY"))
12+ {
13+ g_variant_builder_add(&builder, "{sv}",
14+ SIGNON_SESSION_DATA_UI_POLICY,
15+ g_variant_new_int32(SIGNON_POLICY_DEFAULT)); // LCOV_EXCL_LINE
16+ }
17+ else
18+ {
19+ g_variant_builder_add(&builder, "{sv}",
20+ SIGNON_SESSION_DATA_UI_POLICY,
21+ g_variant_new_int32(SIGNON_POLICY_NO_USER_INTERACTION));
22+ }
23+
24 info->auth_params.reset(
25- g_variant_ref_sink(ag_auth_data_get_login_parameters(auth_data.get(), nullptr)), free_variant);
26+ g_variant_ref_sink(ag_auth_data_get_login_parameters(auth_data.get(), g_variant_builder_end(&builder))), free_variant);
27
28 // Start signon process
29 signon_auth_session_process_async(info->session.get(),
30@@ -377,6 +393,13 @@
31 std::rethrow_exception(thread_exception_); // LCOV_EXCL_LINE
32 }
33
34+ // Update the accounts we already know about
35+ for (auto const& info : accounts_)
36+ {
37+ service_update_cb(info.second->account_service.get(), ag_account_service_get_enabled(info.second->account_service.get()), info.second.get());
38+ }
39+
40+ // Find new account we don't yet know about
41 std::shared_ptr<GList> enabled_accounts(ag_manager_list(manager_.get()), ag_manager_list_free);
42 GList* it;
43 for (it = enabled_accounts.get(); it; it = it->next)
44
45=== modified file 'test/gtest/scopes/OnlineAccountClient/OnlineAccountClient_test.cpp'
46--- test/gtest/scopes/OnlineAccountClient/OnlineAccountClient_test.cpp 2014-10-13 15:13:12 +0000
47+++ test/gtest/scopes/OnlineAccountClient/OnlineAccountClient_test.cpp 2014-12-11 09:00:52 +0000
48@@ -459,49 +459,6 @@
49 EXPECT_TRUE(wait_for_service_update(disabled_status));
50 }
51
52-TEST_F(OnlineAccountClientTestNoMainLoop, refresh_services_no_main_loop)
53-{
54- auto statuses = oa_client()->get_service_statuses();
55- EXPECT_EQ(0, statuses.size());
56-
57- create_account();
58- oa_client()->refresh_service_statuses();
59-
60- statuses = oa_client()->get_service_statuses();
61- EXPECT_EQ(1, statuses.size());
62- EXPECT_FALSE(statuses[0].service_enabled);
63-
64- enable_service();
65- oa_client()->refresh_service_statuses();
66-
67- statuses = oa_client()->get_service_statuses();
68- EXPECT_TRUE(statuses[0].service_enabled);
69-
70- disable_service();
71- oa_client()->refresh_service_statuses();
72-
73- statuses = oa_client()->get_service_statuses();
74- EXPECT_FALSE(statuses[0].service_enabled);
75-
76- enable_service();
77- oa_client()->refresh_service_statuses();
78-
79- statuses = oa_client()->get_service_statuses();
80- EXPECT_TRUE(statuses[0].service_enabled);
81-
82- disable_account();
83- oa_client()->refresh_service_statuses();
84-
85- statuses = oa_client()->get_service_statuses();
86- EXPECT_FALSE(statuses[0].service_enabled);
87-
88- enable_account();
89- oa_client()->refresh_service_statuses();
90-
91- statuses = oa_client()->get_service_statuses();
92- EXPECT_TRUE(statuses[0].service_enabled);
93-}
94-
95 TEST_F(OnlineAccountClientTestNoMainLoop, authentication)
96 {
97 OnlineAccountClient::ServiceStatus auth_status;

Subscribers

People subscribed via source and target branches

to all changes: